AttachInstances
Manually adds ECS instances to a scaling group.
Operation description
Operation description
-
Before calling this operation, make sure that the following conditions are met:
The scaling group is in the Active state.
No scaling activities are in progress in the scaling group.
-
The ECS instances or ECI instances to be added to the scaling group must meet the following requirements: - The instances must reside in the same region as the scaling group. - The instances must be in the Running state. - The instances must not be added to other scaling groups. - The billing method of the instances is subscription or pay-as-you-go, or the instances are spot instances. - If a vSwitch ID is specified for the scaling group, classic network-connected ECS instances or ECI instances and ECS instances or ECI instances in other VPCs cannot be added to the scaling group. - If no vSwitch ID is specified for the scaling group, VPC-connected ECS instances or ECI instances cannot be added to the scaling group.
-
The managed instances to be added to the scaling group must meet the following requirements:
The instances must reside in the same region as the scaling group.
Only managed instances that are not added to any scaling group can be added to an ECS scaling group.
Managed instances do not support lifecycle hooks, association with load balancing, or the health check feature.
After managed instances are added to an ECS scaling group, the scaling group does not manage the lifecycle of the managed instances.
Managed instances can only be manually added to or removed from the scaling group. Removed managed instances are not released.
-
When you use this operation, take note of the following items:
If no scaling activities are in progress in the scaling group, this operation can bypass the cooldown time and be executed directly.
A success response only indicates that the Auto Scaling service has accepted the request and the scaling activity can be executed. It does not mean that the scaling activity will be executed successfully. You must use the returned ScalingActivityId to check the execution status of the scaling activity.
If the sum of the number of instances specified in this operation and the current number of instances in the scaling group (Total Capacity) is greater than the maximum number of instances (MaxSize), the call fails.
ECS instances, ECI instances, or managed instances manually added by using this operation are not associated with the active scaling configuration of the scaling group.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ess:AttachInstances |
update |
*ScalingGroup
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ScalingGroupId |
string |
Yes |
The ID of the scaling group. |
asg-bp18p2yfxow2dloq**** |
| Entrusted |
boolean |
No |
Specifies whether to entrust the lifecycle of an existing instance to the scaling group when the instance is manually added to the scaling group. Valid values:
Note
Subscription instances, managed instances, and instances in the economical mode in the scaling group do not support this parameter. Default value: false. |
false |
| InstanceId |
array |
No |
InstanceId.N specifies instance ID of the ECS instance, ECI instance, managed instance, or instance in the economical mode in the scaling group to be added. Valid values of N: 1 to 20. Examples:
Note
Only one type of instance can be processed in a single call. |
i-28wt4**** |
|
string |
No |
InstanceId.N specifies instance ID of the ECS instance, ECI instance, managed instance, or instance in the economical mode in the scaling group to be added. Valid values of N: 1 to 20. Examples:
Note
Only one type of instance can be processed in a single call. |
i-28wt4**** |
|
| LoadBalancerWeight |
array |
No |
The weight of the ECS instance or ECI instance when it acts as a backend server for a load balancer. Note
Managed instances and instances in the economical mode in the scaling group do not support this parameter. |
50 |
|
integer |
No |
LoadBalancerWeight.N specifies the weight of the ECS instance or ECI instance when it acts as a backend server for a load balancer. Valid values of N: 1 to 20. Valid values of this parameter: 1 to 100. Note
Managed instances and instances in the economical mode in the scaling group do not support this parameter. Default value: 50. |
50 |
|
| LifecycleHook |
boolean |
No |
Specifies whether to trigger the scale-out lifecycle hook when instances are added to the scaling group. Valid values:
Note
Managed instances and instances in the economical mode in the scaling group do not support this parameter. Default value: false. |
false |
| RegionId |
string |
No |
The region ID of the scaling group. |
cn-qingdao |
| ClientToken |
string |
No |
Ensures the idempotence of the request. You can generate a parameter value on your client to ensure that the parameter value is unique across different requests. The parameter value can only contain ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence. |
123e4567-e89b-12d3-a456-42665544**** |
| IgnoreInvalidInstance |
boolean |
No |
Specifies whether to ignore invalid instances when a batch of instances is added to the scaling group. Valid values:
Default value: false. |
false |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| ScalingActivityId |
string |
The ID of the scaling activity. |
asa-bp1crxor24s28xf1**** |
| RequestId |
string |
The request ID. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3**** |
Examples
Success response
JSON format
{
"ScalingActivityId": "asa-bp1crxor24s28xf1****",
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 500 | InternalError | The request processing has failed due to some unknown error, exception or failure. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.