amazon ec2 - Error detaching Instances from Autoscaling


Keywords:amazon  ec2 


Question: 

In trying to detach a list of more than 50 instances from EC2 autoscaling, I got the following validation error :

 conn_as.detach_instances(autoScalingGroup.name,listOfInstances,decrement_capacity=True)

List exceeds the maximum number of instances to detach. Please retry your request with fewer instances.

How can I force the detachment of all the requested number of instances ?

Note: I am using boto2


1 Answer: 

As per the Official documentation AWS AutoScaling Limits,

You can use AttachInstances, DetachInstances, EnterStandby, and ExitStandby with at most 20 instance IDs at a time.

So, either you can reduce the number at your end or raise a support ticket with AWS to check if they can increase the limit for your account.