All Products
Search
Document Center

Auto Scaling:DetachVServerGroups

Last Updated:May 07, 2024

Detaches vServer groups from a scaling group. Auto Scaling supports the attachment of load balancers to scaling groups to improve service performance. If the load balancer currently attached to your scaling group is no longer needed to distribute the access traffic to the instances in the scaling group, you can call the DetachVServerGroups operation to detach one or several vServer groups of this load balancer from the scaling group.

Usage notes

  • When you call the DetachVServerGroups operation, you must use the following parameters to specify the vServer groups that you want to detach from your scaling group:
    • LoadBalancerId: the ID of the load balancer.
    • VServerGroupId: the ID of the vServer group.
    • Port: the port number of the vServer group.
  • When the vServer group specified by the request parameters matches that attached to your scaling group, this operation yields a favorable result. Otherwise, the request is ignored and no error is reported.
  • Before you call this operation, you must make sure that the load balancer has ceased routing the access traffic to the instances in the scaling group. Failure to do so may lead to service requests being dropped or lost during the detachment process.

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 DetachVServerGroups

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

RegionId String Yes cn-hangzhou

The region ID of the scaling group. Examples: cn-hangzhou and cn-shanghai. For more information, see Regions and zones.

ScalingGroupId String Yes asg-bp1fo0dbtsbmqa9h****

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 How to ensure idempotence.

ForceDetach Boolean No false

Specifies whether to remove the existing instances in the scaling group from the vServer group that you want to detach from the scaling group.

  • true: If you set this parameter to true, the detachment of the load balancer from the scaling group entails automatic removal of the existing instances in the scaling group from the corresponding vServer group.
  • false: If you set this parameter to false, the detachment of the load balancer from the scaling group does not entail automatic removal of the existing instances in the scaling group from the corresponding vServer group.

Default value: false.

VServerGroup.N.VServerGroupAttribute.N.VServerGroupId String No rsp-bp1jp1rge****

The ID of vServer group N.

  • The first N in this parameter specifies the serial number of the load balancer. Valid values of the first N: 1 to 5.
  • The second N in this parameter specifies the serial number of the vServer group that belongs to the load balancer. Valid values of the second N: 1 to 5.
VServerGroup.N.VServerGroupAttribute.N.Port Integer No 22

The port over which Auto Scaling adds Elastic Compute Service (ECS) instances or elastic container instances of the scaling group to vServer group N. Valid values: 1 to 65535.

  • The first N in this parameter specifies the serial number of the load balancer. Valid values of the first N: 1 to 5.
  • The second N in this parameter specifies the serial number of the vServer group that belongs to the load balancer. Valid values of the second N: 1 to 5.
VServerGroup.N.LoadBalancerId String No lb-bp1p90y3ya9h8s62d****

The ID of the load balancer to which vServer group N belongs.

N specifies the serial number of the load balancer. Valid values of N: 1 to 5.

Note In each call, you can detach up to five load balancers from a scaling group.

Response parameters

Parameter

Type

Example

Description

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

The request ID.

Examples

Sample requests

http(s)://ess.aliyuncs.com/?Action=DetachVServerGroups
&RegionId=cn-hangzhou
&ScalingGroupId=asg-bp1fo0dbtsbmqa9h****
&ClientToken=123e4567-e89b-12d3-a456-42665544****
&ForceDetach=false
&VServerGroup=[{"VServerGroupAttribute":[{"VServerGroupId":"rsp-bp1jp1rge****","Port":22}],"LoadBalancerId":"lb-bp1p90y3ya9h8s62d****"}]
&<Common request parameters>

Sample success responses

XML format

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

<DetachVServerGroupsResponse>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3****</RequestId>
</DetachVServerGroupsResponse>

JSON format

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

{
  "RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****"
}

Error codes

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

HTTP status code

Error code

Error message

Description

403

Forbidden.Unauthorized

A required authorization for the specified action is not supplied.

Auto Scaling is not authorized to call the specified operation.

404

InvalidScalingGroupId.NotFound

The specified scaling group does not exist.

The specified scaling group does not exist within the Alibaba Cloud account.

400

InvalidParameter

The specified value of parameter "%s" is not valid.

The value of a parameter is invalid.

400

MissingParameter

The input parameter "%s" that is mandatory for processing this request is not supplied.

A required parameter is not specified.