All Products
Search
Document Center

Auto Scaling:SetInstanceHealth

更新時間:May 10, 2024

Sets instance health. At times, the automatic health check system might not sufficiently determine the precise health status of your Elastic Compute Service (ECS) instances or elastic container instances. To overcome this, you can call the SetInstanceHealth operation to swiftly pinpoint problematic instances and resolve issues. This operation is designed to more precisely align with real-world business requirements and tackle O&M hurdles efficiently.

Usage notes

Auto Scaling detects and removes unhealthy ECS instances or elastic container instances from corresponding scaling groups. If you want to retain a specific instance in the corresponding scaling group, you can put the instance into the Standby or Protected state. For more information, see EnterStandby and SetInstancesProtection.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action

String

Yes

SetInstanceHealth

The operation that you want to perform. Set the value to SetInstanceHealth.

InstanceId

String

Yes

i-bp1ap6bro51a7fsa****

The ID of the instance.

HealthStatus

String

Yes

Healthy

The health status of the instance. Valid values:

  • Healthy: sets the instance as healthy.

  • Unhealthy: sets the instance as unhealthy.

Response parameters

Parameter

Type

Example

Description

RequestId

String

B755AE57-6093-43E4-938E-DEA422A9****

The request ID.

Examples

Sample requests

http(s)://ess.aliyuncs.com/?Action=SetInstanceHealth
&InstanceId=i-bp1ap6bro51a7fsa****
&HealthStatus=Healthy
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<SetInstanceHealthResponse>
    <RequestId>B755AE57-6093-43E4-938E-DEA422A9****</RequestId>
</SetInstanceHealthResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "B755AE57-6093-43E4-938E-DEA422A9****"
}

Error codes

For a list of error codes, see Service error codes.

HTTP status code

Error code

Error message

Description

400

InvalidInstanceId.NotFound

Instance "%s" does not exist.

The instance does not exist in the scaling group.

400

InvalidParameter

The specified value of parameter "%s" is not valid.

The value that you assigned to a parameter is invalid.