Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Auto Scaling "place" instances when used with multiple availability zones?

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.

like image 825
pmaugeri Avatar asked Mar 28 '13 17:03

pmaugeri


1 Answers

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.

like image 191
Steffen Opel Avatar answered Sep 18 '22 16:09

Steffen Opel