You can call this operation to add one or more SLB instances 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 SLB backend server contains an instance of the VPC type, the instance and the scaling group must be in the same VPC.
  • The number of added SLB instances must be less than the quota of instances in the scaling group.

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
LoadBalancer.N RepeatList Yes lb-2zeur05gfs****

The IDs of SLB instances. You can add up to five SLB instances to a scaling group at a time.

ScalingGroupId String Yes AG6CQdPU8OKdwLjgZcJ****

The ID of the scaling group.

Action String No AttachLoadBalancers

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

ForceAttach Boolean No false

Specifies whether to add all instances in the current scaling group to the SLB backend server. Valid values:

  • true: adds all instances to the backend server.
  • false: does not add any instances to the backend server.

Default value: false

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=AttachLoadBalancers
&ScalingGroupId=AG6CQdPU8OKdwLjgZcJ****
&LoadBalancer.1=lb-2zeur05gfs****
&<Common request parameters>

Sample success responses

XML format

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

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.

400

QuotaExceeded.LoadBalancer

LoadBalancer quota exceeded in the scaling group "%s".

The error message returned because the maximum number of SLB instances in the scaling group has been reached.

404

InvalidLoadBalancerId.NotFound

The load balancer "%s" does not exist.

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

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

QuotaExceeded.BackendServer

Backend server quota exceeded in the load balancer "%s".

The error message returned because the maximum number of backend servers of the SLB instance has been reached.

404

InvalidScalingConfigurationId.NotFound

The specified scaling configuration does not exist.

The error message returned because the specified scaling configuration that is enabled for the current scaling group does not exist.