Amazon AWS autoscaling leader_only attribute


I can’t find much documentation on the leader_only attribute of Amazon’s EC2 instances.

What happens to the leader when an autoscaling group scales down? The default autoscaling template terminates the oldest instance (which presumably would be the leader in most cases). After terminating the oldest instance does EC2 automatically elect a new leader? Or does the application only terminate non-leader instances?

Also, what if the leader fails. Does it create a new instance and name it the leader, or does it switch the leader attribute to a different existing instance?



The idea of a leader only exists during the execution of a deployment in an environment update. After deployment has executed, there isn’t a concept of a leader anymore


The link also has some code for a roll-your-own leader implementation, although depending on your needs it may be easier to figure something else out.

Leave a Reply