Removes one or more Elastic Compute Service (ECS) instances or elastic container instances from a scaling group.
Operation description
After ECS instances or elastic container instances are removed from a scaling group, you can call the AttachInstances operation to add the ECS instances or elastic container instances that are removed from the scaling group to other scaling groups.
After you remove an ECS instance or elastic container instance by calling the DetachInstances operation, the instance is not stopped or released.
Before you call this operation, make sure that the following conditions are met:
- The specified scaling group is enabled.
- No scaling activities in the specified scaling group are in progress.
A successful call indicates only that Auto Scaling accepts the request. However, 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.
The number of ECS instances or elastic container instances in a scaling group after you remove a specific number of instances from the scaling group must be equal to or greater than the value of the MinSize parameter. Otherwise, an error is reported when you call the DetachInstances operation.
Debugging
Authorization information
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ScalingGroupId | string | Yes | The ID of the scaling group. | asg-bp1igpak5ft1flyp**** |
DecreaseDesiredCapacity | boolean | No | Specifies whether to adjust the expected number of instances in the scaling group. Valid values:
Default value: true. | true |
DetachOption | string | No | Specifies whether to remove the instances from the default server group and vServer groups of the Classic Load Balancer (CLB) instance that is associated with the scaling group, and whether to remove the IP addresses of the instances from the whitelist that manages access to the ApsaraDB RDS instance that is associated with the scaling group. If you set this parameter to both, the instances are removed from the default sever group and vServer groups of the associated CLB instance, and the IP addresses of the instances are removed from the whitelist that manages access to the associated ApsaraDB RDS instance. | both |
InstanceIds | array | Yes | The IDs of the ECS instances or elastic container instances that you want to remove from the scaling group. | |
string | Yes | The IDs of the ECS instances or elastic container instances that you want to remove from the scaling group. You can specify 1 to 20 instance IDs. Examples:
| i-bp109k5j3dum1ce6**** | |
LifecycleHook | boolean | No | Specifies whether to trigger a lifecycle hook for a scale-in activity. Valid values:
Default value: false. | false |
Response parameters
Examples
Sample success responses
JSON
format
{
"ScalingActivityId": "asa-bp1gbswjhjrw8tko****",
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****"
}
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 |
---|