Adds Elastic Compute Service (ECS) instances, elastic container instances, or managed instances to a scaling group.
Operation description
Before you call this operation, take note of the following items:
- The scaling group is in the Active state.
- No scaling activities in the scaling group are in progress.
The ECS instances or the elastic container instances that you want to add to a scaling group must meet the following requirements:
- The instances reside in the same region as the scaling group.
- The instances must be in the Running state.
- The instances are not added to other scaling groups.
- The instances use the subscription or pay-as-you-go billing method, or are preemptible instances.
- If the VswitchID parameter is specified for a scaling group, the instances that are in the classic network or those that are not in the same virtual private cloud (VPC) as the specified vSwitch cannot be added to the scaling group.
- If the VswitchID parameter is not specified for a scaling group, the instances that are in VPCs cannot be added to the scaling group.
If no scaling activities in the specified scaling group are in progress, the operation can trigger scaling activities even before the cooldown time expires.
A successful call indicates that Auto Scaling accepts the request. However, the scaling activity may still fail. You can obtain the status of a scaling activity by using the value of the ScalingActivityId parameter in the response.
If the sum of the number of instances that you want to add and the number of existing instances in the scaling group is greater than the value of the MaxSize parameter, the call fails.
Instances that are manually added by calling the AttachInstances operation are not associated with the active scaling configuration of the scaling group.
Debugging
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.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
ess:AttachInstances | Write |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ScalingGroupId | string | Yes | The ID of the scaling group. | asg-bp18p2yfxow2dloq**** |
Entrusted | boolean | No | Specifies whether the scaling group manages the lifecycles of instances that are manually added to the scaling group. Valid values:
Note
You cannot specify this parameter for subscription instances.
Default value: false. | false |
InstanceIds | array | No | The IDs of the ECS instances or elastic container instances that you want to add. | |
string | No | The IDs of the ECS instances or elastic container instances that you want to add. You can specify 1 to 20 instance IDs. Examples:
| i-28wt4**** | |
LoadBalancerWeights | array | No | The weights of the ECS instances or elastic container instances as the backend servers of the associated Classic Load Balancer (CLB) instance. | |
integer | No | The weights of the ECS instances or elastic container instances as the backend servers of the associated CLB instance. Valid values: 1 to 100. Default value: 50. | 50 | |
LifecycleHook | boolean | No | Specifies whether to trigger a lifecycle hook for a scale-out activity. Valid values:
Default value: false. | false |
RegionId | string | No | The region ID of the scaling group. | cn-qingdao |
Response parameters
Examples
Sample success responses
JSON
format
{
"ScalingActivityId": "asa-bp1crxor24s28xf1****",
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
Error codes
HTTP status code | Error code | Error message |
---|---|---|
500 | InternalError | The request processing has failed due to some unknown error, exception or failure. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|