Rebalances Elastic Compute Service (ECS) instances in a multi-zone scaling group.
Description
To rebalance ECS instances in a multiple-zone scaling group, Auto Scaling creates ECS instances to replace the existing instances. Auto Scaling starts the created instances before it terminates the existing instances. This ensures that the performance and availability of your applications are not affected.
- You can call this operation only if you set the MultiAZPolicy parameter of the multi-zone scaling group to BALANCE.
- You can rebalance ECS instances in a scaling group only when the distribution of ECS instances in the scaling group is significantly imbalanced.
- You can replace up to 20 ECS instances during a rebalancing activity.
- If the number of ECS instances in the scaling group approaches or reaches the maximum number of instances that is specified by the MaxSize parameter during a rebalancing activity and the rebalancing activity must continue, Auto Scaling allows the number of ECS instances in the scaling group to temporarily exceed the maximum number. The excess number of instances ranges from one to 10% of the value of the MaxSize parameter. In most cases, Auto Scaling requires one to six minutes to rebalance the instances in the scaling group when the number of instances in the scaling group exceeds the maximum number.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | RebalanceInstances |
The operation that you want to perform. Set the value to RebalanceInstances. |
ScalingGroupId | String | Yes | asg-bp18p2yfxow2dloq**** |
The ID of the scaling group. |
RegionId | String | No | cn-hangzhou |
The ID of the region where the scaling group resides. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
ScalingActivityId | String | asa-kjgffgdfadah**** |
The ID of the scaling activity. |
RequestId | String | 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
The ID of the request. |
Examples
Sample requests
http(s)://ess.aliyuncs.com/?Action=RebalanceInstances
&ScalingGroupId=asg-bp18p2yfxow2dloq****
&RegionId=cn-hangzhou
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<RebalanceInstancesResponse>
<ScalingActivityId>asa-kjgffgdfadah****</ScalingActivityId>
<RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
</RebalanceInstancesResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"ScalingActivityId" : "asa-kjgffgdfadah****",
"RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
Error codes
For a list of error codes, visit the API Error Center.
HTTP status code |
Error code |
Error message |
Description |
---|---|---|---|
400 |
IncorrectScalingGroupStatus |
The current status of the specified scaling group does not support this action. |
The error message returned because the scaling group is disabled. |
400 |
OperationDenied |
This operation is denied because the specified scaling group does not support this action. |
The error message returned because the MultiAZPolicy parameter of the scaling group is not set to BALANCE, or because the distribution of ECS instances in the scaling group is slightly imbalanced. |
403 |
Forbidden.Unauthorized |
A required authorization for the specified action is not supplied. |
The error message returned because you are not authorized to call the RebalanceInstances operation. |
404 |
InvalidScalingGroupId.NotFound |
The specified scaling group does not exist. |
The error message returned because the scaling group does not exist within the Alibaba Cloud account. |