AttachInstances
Attaches one or more EC2 instances to the specified Auto Scaling group.
When you attach instances, Amazon EC2 Auto Scaling increases the desired capacity of the group by the number of instances being attached. If the number of instances being attached plus the desired capacity of the group exceeds the maximum size of the group, the operation fails.
If there is a Classic Load Balancer attached to your Auto Scaling group, the instances are also registered with the load balancer. If there are target groups attached to your Auto Scaling group, the instances are also registered with the target groups.
For more information, see Detach or attach instances in the Amazon EC2 Auto Scaling User Guide.
Request Parameters
For information about the parameters that are common to all actions, see Common Parameters.
- AutoScalingGroupName
-
The name of the Auto Scaling group.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 255.
Pattern:
[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*
Required: Yes
- InstanceIds.member.N
-
The IDs of the instances. You can specify up to 20 instances.
Type: Array of strings
Length Constraints: Minimum length of 1. Maximum length of 19.
Pattern:
[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*
Required: No
Errors
For information about the errors that are common to all actions, see Common Errors.
- ResourceContention
-
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
HTTP Status Code: 500
- ServiceLinkedRoleFailure
-
The service-linked role is not yet ready for use.
HTTP Status Code: 500
Examples
Example
This example illustrates one usage of AttachInstances.
Sample Request
https://autoscaling.amazonaws.com/?Action=AttachInstances
&AutoScalingGroupName=my-asg
&InstanceIds.member.1=i-1234567890abcdef0
&Version=2011-01-01
&AUTHPARAMS
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: