All Products
Search
Document Center

Auto Scaling:DetachInstances

Last Updated:Jun 06, 2024

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.
Note If no scaling activities in the specified scaling group are in progress, the operation can trigger scaling activities even before the cooldown time expires.

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

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
ScalingGroupIdstringYes

The ID of the scaling group.

asg-bp1igpak5ft1flyp****
DecreaseDesiredCapacitybooleanNo

Specifies whether to adjust the expected number of instances in the scaling group. Valid values:

  • true: After a specific number of instances are removed from the scaling group, the expected number of instances in the scaling group decreases.
  • false: After a specific number of instances are removed from the scaling group, the expected number of instances in the scaling group remains unchanged.

Default value: true.

true
DetachOptionstringNo

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
InstanceIdsarrayYes

The IDs of the ECS instances or elastic container instances that you want to remove from the scaling group.

stringYes

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:

  • The ID of the ECS instance that you want to remove is i-bp109k5j3dum1ce6****.
  • The ID of the elastic container instance that you want to remove is eci-bp17gw49eu09yiwm****.
i-bp109k5j3dum1ce6****
LifecycleHookbooleanNo

Specifies whether to trigger a lifecycle hook for a scale-in activity. Valid values:

  • true
  • false

Default value: false.

false

Response parameters

ParameterTypeDescriptionExample
object
ScalingActivityIdstring

The ID of the scaling activity.

asa-bp1gbswjhjrw8tko****
RequestIdstring

The ID of the request.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3****

Examples

Sample success responses

JSONformat

{
  "ScalingActivityId": "asa-bp1gbswjhjrw8tko****",
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****"
}

Error codes

HTTP status codeError codeError message
500InternalErrorThe 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 timeSummary of changesOperation
2024-05-21The Error code has changed. The request parameters of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 500
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: IgnoreInvalidInstance