Removes one or more Elastic Compute Service (ECS) instances or elastic container instances from a 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
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
ess:RemoveInstances | Write |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ScalingGroupId | string | Yes | The ID of the scaling group. | asg-bp18p2yfxow2dloq**** |
RemovePolicy | string | No | The action that you want Auto Scaling to perform after the ECS instance is removed from the scaling group. Valid values:
The ScalingPolicy parameter that you specify when you call the CreateScalingGroup operation specifies the reclaim mode of the scaling group. The RemovePolicy parameter that you specify when you call the RemoveInstances operation specifies the action to be performed on ECS instances after the ECS instances are removed. Example:
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 |
InstanceIds | array | Yes | The IDs of the ECS instances that you want to remove from the scaling group. | |
string | Yes | The IDs of the ECS instances that you want to remove from the scaling group. You can specify 1 to 20 IDs. | i-28wt4**** | |
RegionId | string | No | The region ID of the scaling group. | cn-qingdao |
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 |
---|