Removes one or more instances from a scaling group. If your scaling group is enabled and contains no ongoing scaling activities, you can call the RemoveInstances operation to remove instances that you no longer require from the scaling group.
Operation description
-
Before you call this operation, make sure that the following requirements are met:
- The scaling group is in the Active state.
- No scaling activity is in progress within the scaling group.
- If an ECS instance is automatically created by Auto Scaling, or if an ECS instance is manually added to a scaling group and managed by the scaling group, the ECS instance is stopped in economical mode or is released after the instance is removed from the scaling group.
- If an ECS instance is manually added to a scaling group and is not managed by the scaling group, the ECS instance is not stopped or released after the instance is removed from the scaling group.
- If the difference between the number of existing ECS instances specified by the TotalCapacity parameter and the number of ECS instances that you call this operation to remove is less than the value of the MinSize parameter, the call fails.
A successful call only means that Auto Scaling accepts the request. The scaling activity may still fail. You can obtain the status of a scaling activity based on the value of the ScalingActivityId parameter in the response.
Debugging
Authorization information
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ScalingGroupId | string | Yes | The ID of the scaling group. | asg-bp18p2yfxow2dloq**** |
RemovePolicy | string | No | The action subsequent to the removal of the Elastic Compute Service (ECS) instances. Valid values:
ScalingPolicy of the CreateScalingGroup operation specifies the reclaim mode of the scaling group while RemovePolicy of the RemoveInstances operation specifies the subsequent action when an ECS instance is removed from the scaling group. Examples:
Default value: release. | release |
DecreaseDesiredCapacity | boolean | No | Specifies whether to adjust the expected number of ECS instances in the scaling group. Valid values:
Default value: true. | true |
IgnoreInvalidInstance | boolean | No | Specifies whether to ignore invalid instances when you remove a batch of instances from the scaling group. Valid values:
Default value: false. | false |
InstanceIds | array | Yes | The IDs of the ECS instances that you want to remove from the scaling group. | |
string | Yes | The ID of the ECS instance that you want to remove from the scaling group. | i-28wt4**** | |
RegionId | string | No | The region ID of the scaling group. | cn-qingdao |
ClientToken | string | No | The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence. | 123e4567-e89b-12d3-a456-42665544**** |
Response parameters
Examples
Sample success responses
JSON
format
{
"ScalingActivityId": "asa-bp175o6f6ego3r2j****",
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
Error codes
HTTP status code | Error code | Error message |
---|---|---|
500 | InternalError | The request processing has failed due to some unknown error, exception or failure. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2024-05-21 | The Error code has changed. The request parameters of the API has changed | View Change Details |