AutoScaling / Client / attach_instances
attach_instances#
- AutoScaling.Client.attach_instances(**kwargs)#
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.
See also: AWS API Documentation
Request Syntax
response = client.attach_instances( InstanceIds=[ 'string', ], AutoScalingGroupName='string' )
- Parameters:
InstanceIds (list) –
The IDs of the instances. You can specify up to 20 instances.
(string) –
AutoScalingGroupName (string) –
[REQUIRED]
The name of the Auto Scaling group.
- Returns:
None
Exceptions
Examples
This example attaches the specified instance to the specified Auto Scaling group.
response = client.attach_instances( AutoScalingGroupName='my-auto-scaling-group', InstanceIds=[ 'i-93633f9b', ], ) print(response)
Expected Output:
{ 'ResponseMetadata': { '...': '...', }, }