All Products
Search
Document Center

Auto Scaling:AttachInstances

Last Updated:Jan 05, 2023

Manually adds Elastic Compute Service (ECS) instances or elastic container instances to a scaling group.

Operation Description

Manually adds Elastic Compute Service (ECS) instances or elastic container instances to a scaling group.

Authorization information

The following table is the authorization information corresponding to the API, which can be found in the RAM permission policy statement.Action Used in the element to grant the RAM user or RAM role permission to call this API. The specific instructions are as follows:

  • 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 keyword: refers to the condition keyword defined by the cloud product itself.
  • 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.
Operateaccess levelResource typeconditional keywordAssociation operation
ess:AttachInstancesWrite
  • AutoScaling
    acs:ess:{#regionId}:{#accountId}:scalinggroup/{#ScalingGroupId}
    without
without

Request parameters

ParameterTypeRequiredDescriptionExample
ScalingGroupIdstringYes

Specifies whether the scaling group manages the lifecycles of instances that are manually added to the scaling group. Valid values:

  • true: The scaling group manages the lifecycles of instances that are manually added in a similar manner in which the scaling group manages the lifecycles of automatically created instances. After Auto Scaling removes instances from the scaling group, Auto Scaling releases the instances. After you call the DetachInstances operation to remove instances from the scaling group, Auto Scaling does not release the instances.
  • false: The scaling group does not manage the lifecycles of instances that are manually added. After Auto Scaling removes instances from the scaling group, Auto Scaling does not release the instances.
NoteYou cannot specify this parameter for subscription instances.

Default value: false.

asg-bp18p2yfxow2dloq****
EntrustedbooleanNo

The IDs of the ECS instances or elastic container instances that you want to add.

false
InstanceIdsarrayNo

The IDs of the ECS instances or elastic container instances that you want to add. You can specify 1 to 20 instance IDs.

Examples:

  • The ID of the ECS instance that you want to add is i-28wt4****.
  • The ID of the elastic container instance that you want to add is eci-bp17gw49eu09yiwm****.
stringNo

The weights of the ECS instances or elastic container instances as the backend servers of the associated Classic Load Balancer (CLB) instance.

i-28wt4****
LoadBalancerWeightsarrayNo

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.

integerNo

Specifies whether to trigger a lifecycle hook for a scale-out activity. Valid values:

  • true
  • false

Default value: false.

50
LifecycleHookbooleanNo

The region ID of the scaling group.

false
RegionIdstringNo

The ID of the scaling activity.

cn-qingdao

Response parameters

ParameterTypeDescriptionExample
object
ScalingActivityIdstring

The ID of the request.

asa-bp1crxor24s28xf1****
RequestIdstring

auditing

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

Example

Normal return example

JSONFormat

{
  "ScalingActivityId": "asa-bp1crxor24s28xf1****",
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

Error codes

Http codeError codeError message
500InternalErrorThe request processing has failed due to some unknown error, exception or failure.

For a list of error codes, visit the API error center.