Consider the case when an Auto Scaling group is configured to span multiple availability zones (such as in this scenario). When a new Amazon EC2 instance should be added to the scaling group (scale out) based on demand, how does Auto Scaling decide in which availability zone the instance will be placed? The one that has the smaller number of instances?
Thanks for your help.
As you expected, Auto Scaling would indeed select a zone that has the smaller number of instances, section Instance Distribution and Balance Across Multiple Zones within Availability Zones and Regions explains the general algorithm employed by Auto Scaling:
Auto Scaling attempts to distribute instances evenly between the Availability Zones that are enabled for your Auto Scaling group. Auto Scaling does this by attempting to launch new instances in the Availability Zone with the fewest instances. If the attempt fails, however, Auto Scaling will attempt to launch in other zones until it succeeds. [emphasis mine]
An Auto Scaling group can also become unbalanced between the zones by various conditions (e.g. active termination of an instance), which can trigger an Auto Scaling rebalancing activity - please check the documentation linked above for more details on this and how edge cases are handled.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With