All Products
Search
Document Center

Auto Scaling:DetachServerGroups

最終更新日:May 30, 2024

Detach server groups from a scaling group. To seamlessly adjust the number of instances in response to changes in your business workload or to maintain the uninterrupted accessibility of your application, you can call the DetachServerGroups operation. By detaching Application Load Balancer (ALB) or Network Load Balancer (NLB) server groups from your scaling group, this operation enables Auto Scaling to automatically tailor your computing capacity to your business needs. Furthermore, it optimizes traffic routing by dynamically allocating incoming requests based on current workload patterns, which significantly improves the stability and performance of your application.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action

String

Yes

DetachServerGroups

The operation that you want to perform. Set the value to DetachServerGroups.

RegionId

String

Yes

cn-hangzhou

The region ID of the scaling group.

ScalingGroupId

String

Yes

asg-bp18p2yfxow2dloq****

The ID of the scaling group.

ClientToken

String

No

123e4567-e89b-12d3-a456-42665544****

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 Ensure idempotence.

ForceDetach

Boolean

No

false

Specifies whether to remove the existing Elastic Compute Service (ECS) instances or elastic container instances of the scaling group from server group N marked for detachment. Valid values:

  • true

  • false

Default value: false.

ServerGroup.N.ServerGroupId

String

Yes

sgp-1gv2uidn2msy****

The ID of server group N.

ServerGroup.N.Type

String

Yes

ALB

The type of server group N. Valid values:

  • ALB

  • NLB

ServerGroup.N.Port

Integer

Yes

22

The port used by ECS instances or elastic container instances as backend servers of server group N.

Response parameters

Parameter

Type

Example

Description

ScalingActivityId

String

asa-bp1gbswjhjrw8tko****

The ID of the scaling activity. During the scaling activity, server group N is detached from the scaling group and the existing servers, which are the ECS instances or elastic container instances of the scaling group, are removed from server group N.

Note

This parameter is returned only if you set ForceDetach to true.

RequestId

String

6EF9BFEE-FE07-4627-B8FB-14326FB9****

The request ID.

Examples

Sample requests

http(s)://ess.aliyuncs.com/?Action=DetachServerGroups
&RegionId=cn-hangzhou
&ScalingGroupId=asg-bp18p2yfxow2dloq****
&ClientToken=123e4567-e89b-12d3-a456-42665544****
&ForceDetach=false
&ServerGroup=[{"ServerGroupId":"sgp-1gv2uidn2msy****","Type":"ALB","Port":22}]
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<DetachServerGroupsResponse>
    <ScalingActivityId>asa-bp1gbswjhjrw8tko****</ScalingActivityId>
    <RequestId>6EF9BFEE-FE07-4627-B8FB-14326FB9****</RequestId>
</DetachServerGroupsResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "ScalingActivityId" : "asa-bp1gbswjhjrw8tko****",
  "RequestId" : "6EF9BFEE-FE07-4627-B8FB-14326FB9****"
}

Error codes

For a list of error codes, see Service error codes.