Detaches one or more Server Load Balancer (SLB) instances from a scaling group. You can detach the following types of SLB instances from a scaling group: Application Load Balancer (ALB) instances and Network Load Balancer (NLB) instances.

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 value, but you must ensure that the value is unique among different requests.

The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure the idempotence of a request.

ForceDetach Boolean No false

Specifies whether to remove the Elastic Compute Service (ECS) instances in the scaling group from the backend server group of the SLB instance that you want to detach from the scaling group. Valid values:

  • true
  • false

Default value: false.

ServerGroup.N.ServerGroupId String Yes sgp-1gv2uidn2msy****

The ID of backend server group N.

ServerGroup.N.Type String Yes ALB

The type of backend server group N. Valid values:

  • ALB
  • NLB
ServerGroup.N.Port Integer Yes 22

The port number used by an ECS instance in the scaling group after Auto Scaling adds the ECS instance to backend server group N.

Response parameters

Parameter Type Example Description
ScalingActivityId String asa-bp1gbswjhjrw8tko****

The ID of the scaling activity during which one or more SLB instances are detached from the scaling group and the ECS instance in the scaling group are removed from the backend server groups of the SLB instances.

Note This parameter is returned only after you set the ForceDetach parameter to true.
RequestId String 6EF9BFEE-FE07-4627-B8FB-14326FB9****

The ID of the request.

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.