DetachInstances
Removes one or more ECS instances from a scaling group.
Operation description
Operation description
-
Before calling this operation, ensure that the following conditions are met:
-
The target scaling group must be in the Enabled state.
-
The target scaling group does not have ongoing scaling activities.
NoteIf the target scaling group does not have ongoing scaling activities, this operation can bypass the cooldown time and directly trigger a scaling activity.
-
-
Note the following when using this operation:
After an ECS instance, an ECI instance, or a managed instance is removed, the instance can exist independently of the scaling group. You can call the AttachInstances operation to add the ECS instance, ECI instance, or managed instance to another scaling group.
Calling this operation to remove an ECS instance, an ECI instance, or a managed instance does not stop or release the instance.
A successful call to this operation only indicates that Auto Scaling has accepted the request. A scaling activity can be triggered normally, but the success of the scaling activity is not guaranteed. You must check the status of the scaling activity by using the returned ScalingActivityId.
The number of ECS instances, ECI instances, or managed instances in the target scaling group minus the number of instances to be removed cannot be less than the minimum number of instances (MinSize) in the scaling group. Otherwise, an error is reported.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ess:DetachInstances |
update |
*ScalingGroup
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ScalingGroupId |
string |
Yes |
The ID of the scaling group. |
asg-bp1igpak5ft1flyp**** |
| DecreaseDesiredCapacity |
boolean |
No |
Specifies whether to modify the expected number of instances. Valid values:
Default value: true. |
true |
| IgnoreInvalidInstance |
boolean |
No |
Specifies whether to ignore invalid instances when removing a batch of instances from the scaling group. Valid values:
Default value: false. |
false |
| DetachOption |
string |
No |
Specifies whether to stop using the ECS instances or ECI instances as backend servers of the load balancing instances (that is, remove the ECS instances or ECI instances from the default server group and virtual server group of the load balancing instances), and whether to remove the ECS instances or ECI instances from the access whitelists of the ApsaraDB RDS instances. Valid values: both: Removes the ECS instances or ECI instances from the default server group and virtual server group of the load balancing instances, and removes the ECS instances or ECI instances from the access whitelists of the ApsaraDB RDS instances. Note
Settings for this parameter are not supported when managed instances are removed from the scaling group. |
both |
| InstanceId |
array |
Yes |
The IDs of the ECS instances, ECI instances, or managed instances to be removed. |
i-bp109k5j3dum1ce6**** |
|
string |
No |
Instance ID of the ECS instance, ECI instance, or managed instance to be removed. Valid values of N: 1 to 20. Examples:
Note
You can remove only one type of instance in a single call. |
i-bp109k5j3dum1ce6**** |
|
| LifecycleHook |
boolean |
No |
Specifies whether to trigger the scale-in lifecycle hook when ECS instances or ECI instances are removed from the scaling group. Valid values:
Note
This parameter is not supported when managed instances are removed from the scaling group. Default value: false. |
false |
| ClientToken |
string |
No |
Ensures the idempotence of the request. You can generate a parameter value from your client to ensure that the value is unique across different requests. The value can only contain ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence. |
123e4567-e89b-12d3-a456-42665544**** |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| ScalingActivityId |
string |
The ID of the scaling activity. |
asa-bp1gbswjhjrw8tko**** |
| RequestId |
string |
The ID of the request. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3**** |
Examples
Success response
JSON format
{
"ScalingActivityId": "asa-bp1gbswjhjrw8tko****",
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 500 | InternalError | The request processing has failed due to some unknown error, exception or failure. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.