You can call this operation to add one or more VServer groups under an SLB instance to a scaling group.

Description

Due to the Limits on SLB, before you call this operation, make sure that the following requirements are met:

  • The SLB instance and the scaling group must belong to the same account.
  • The SLB instance and the scaling group must be in the same region.
  • The SLB instance must be in the Running state.
  • The SLB instance must be configured with at least one listener with health check enabled.
  • The SLB instance and the scaling group must be in the same VPC if the network type of both of them is VPC.
  • If the network type of the scaling group is VPC, the network type of the SLB instance is classic network, and the VServer group contains an instance of the VPC type, the instance and the scaling group must be in the same VPC.
  • The VServer group that you want to add to the scaling group must be associated with the SLB instance.
  • You can add up to five VServer groups to a scaling group.
    Note A VServer group is uniquely identified by the combination of the SLB instance ID (LoadBalancerId), VServer group ID (VServerGroupId), and port number of the VServer group (Port). If you have added a VServer group to a scaling group by using different port numbers, Auto Scaling considers that multiple VServer groups are added to the scaling group. If multiple VServer groups that have the same group ID and port number are specified in the request parameters, only the first VServer group is used. The other VServer groups are ignored.

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
RegionId String Yes cn-hangzhou-b

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

ScalingGroupId String Yes asg-****

The ID of the scaling group.

Action String Yes AttachVServerGroups

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

ForceAttach Boolean No false

Specifies whether the ECS instances that belong to the scaling group are to be added to the newly attached VServer group.

  • true: adds the ECS instances to the VServer group.
  • false: does not add the ECS instances to the VServer group.

Default value: false

VServerGroup.N.LoadBalancerId String No lb-****

The ID of SLB instance N with which the VServer group is associated. N indicates the number of the SLB instance. Valid values of N: 1 to 5.

VServerGroup.N.VServerGroupAttribute.N.Port Integer No 22

The port number that is used by Auto Scaling to add the ECS instances to the VServer group M. Valid values: 1 to 65535.

N indicates the number of the SLB instance. Valid values of N: 1 to 5.

M indicates the number of the VServer group that is associated with the SLB instance. Valid values of M: 1 to 5.

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

The ID of VServer group M. N indicates the number of the SLB instance. Valid values of N: 1 to 5.

M indicates the number of the VServer group that is associated with the SLB instance. Valid values of M: 1 to 5.

VServerGroup.N.VServerGroupAttribute.N.Weight Integer No 100

The weight set for the ECS instances that are added to the VServer group. Valid values: 0 to 100.

Default value: 50.

N indicates the number of the SLB instance. Valid values of N: 1 to 5.

M indicates the number of the VServer group that is associated with the SLB instance. Valid values of M: 1 to 5.

Response parameters

Parameter Type Example Description
RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

Examples

Sample requests


http://ess.aliyuncs.com/?Action=AttachVServerGroups
&ScalingGroupId=asg-****
&RegionId=cn-hangzhou
&VServerGroup.1.LoadBalancerId=lb-****
&VServerGroup.1.VServerGroupAttribute.1.VServerGroupId=rsp-****
&VServerGroup.1.VServerGroupAttribute.1.Port=22
&VServerGroup.1.VServerGroupAttribute.1.Weight=100
&<Common request parameters>

Sample success responses

XML format

<AttachVServerGroupsResponse>
      <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
</AttachVServerGroupsResponse>

JSON format

{
	"requestId":"473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

Error codes

For more information about error codes, visit API Error Center.

HTTP status code

Error code

Error message

Description

403

Forbidden.Unauthorized

A required authorization for the specified action is not supplied.

The error message returned because Auto Scaling is not authorized to call the specified operation.

404

InvalidScalingGroupId.NotFound

The specified scaling group does not exist.

The error message returned because the specified scaling group does not exist in the current account.

404

InvalidLoadBalancerId.NotFound

The load balancer "%s" does not exist.

The error message returned because the specified SLB instance does not exist in the current account.

400

InvalidLoadBalancerId.RegionMismatch

The load balancer "%s" and the specified scaling group are not in the same Region.

The error message returned because the SLB instance and the scaling group are not in the same region.

400

IncorrectLoadBalancerStatus

The current status of the load balancer "%s" does not support this action.

The error message returned because the SLB instance is in a state that does not support the current operation.

400

IncorrectLoadBalancerHealthCheck

The current health check type of the load balancer "%s" does not support this action.

The error message returned because health check is not enabled for the specified SLB instance.

400

InvalidLoadBalancerId.VPCMismatch

The specified virtual switch and the instance in the load balancer "%s" are not in the same VPC.

The error message returned because the SLB instance and the scaling group are not in the same VPC.

400

InvalidVServerGroupId.ForLoadBalancer

Invalid VServerGroupId For LoadBalancer "%s".

The error message returned because the VServer group that is specified by the VServerGroupId parameter is not associated with the specified SLB instance.

400

QuotaExceeded.VServerGroup

VServerGroup quota exceeded in the specified scaling group.

The error message returned because the maximum number of VServer groups attached to the scaling group has been reached.