All Products
Search
Document Center

Auto Scaling:AttachVServerGroups

Last Updated:Nov 11, 2024

Attaches vServer groups to a scaling group. After a Classic Load Balancer (CLB) instance is attached to your scaling group, the instances in the scaling group are automatically added as backend servers of the CLB instance. These servers then handle requests forwarded by the CLB instance, streamlining the processing of incoming traffic. To direct varying access requests to separate backend servers or to distribute requests based on domain names or URLs, you can call the AttachVServerGroups operation. This operation enables the addition of multiple vServer groups, allowing for efficient management of various backend server configurations tailored to your routing preferences.

Operation description

  • Before you call this operation, make sure that the following requirements are met:

    • The CLB instance and the scaling group belong to the same Alibaba Cloud account.
    • The CLB instance and the scaling group reside in the same region.
    • The CLB instance is in the Running state.
    • The CLB instance is configured with at least one listener. The health check feature is enabled for the CLB instance.
    • If the network type of both the CLB instance and the scaling group is virtual private cloud (VPC), they use the same VPC.
    • If the network type of the scaling group is VPC and the network type of the CLB instance is classic network, any backend server of the CLB instance within a VPC setup shares the same VPC as the scaling group.
    • The vServer groups that you want to attach to the scaling group belong to the CLB instance.
    • The operation to attach vServer groups does not result in the total number of vServer groups exceeding the predefined quota limit. For information about the vServer group quota, see Limits .
  • When you call this operation to attach vServer groups, you must specify the following parameters:

    • LoadBalancerId: the ID of the CLB instance
    • VServerGroupId: the ID of the vServer group
    • Port: the port number of the vServer group

    **

    Note If you attempt to attach the same vServer group to a scaling group multiple times over the identical port, the system regards each attempt as a separate vServer group attachment to the scaling group. In your request, if you include the same vServer group ID coupled with the same port number multiple times, only the first configuration of the vServer group and port number pairing is considered valid. Subsequent vServer group and port number parings are disregarded.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ess:AttachVServerGroupsupdate
  • ScalingGroup
    acs:ess:{#regionId}:{#accountId}:scalinggroup/{#ScalingGroupId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

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

cn-hangzhou
ScalingGroupIdstringYes

The ID of the scaling group.

asg-bp18p2yfxow2dloq****
ClientTokenstringNo

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.

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

Specifies whether to add the existing Elastic Compute Service (ECS) instances or elastic container instances in the scaling group to the new vServer group. Valid values:

  • true
  • false

Default value: false.

false
VServerGroupsarray<object>Yes

The information about the vServer groups.

objectYes

Details of the vServer groups.

VServerGroupAttributesarray<object>No

The attributes of the vServer group.

objectNo

Details of the vServer group attributes.

VServerGroupIdstringNo

The ID of the vServer group.

lb-bp1u7etiogg38yvwz****
WeightintegerNo

The weight of an ECS instance or elastic container instance as a backend server. Valid values: 0 to 100.

Default value: 50.

100
PortintegerNo

The port number over which Auto Scaling adds ECS instances or elastic container instances to the new vServer group. Valid values: 1 to 65535.

22
LoadBalancerIdstringNo

The ID of the CLB instance to which the new vServer group belongs.

rsp-bp1jp1rge****

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

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

Examples

Sample success responses

JSONformat

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

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history