Amazon AWS autoscaling leader_only attribute

I cannot find much documentation on the leader_only attribute of Amazon EC2 instances.

What happens to a leader when an auto-scale group scales? The default autoscale template completes the oldest instance (which would presumably be the leader in most cases). After completing the oldest instance, does EC2 automatically choose a new leader? Or does the application only close instances other than the leader?

Also, what if the leader fails. Does he create a new instance and call him a leader, or switches the leading attribute to another existing instance?

Thanks!

+4
source share
3 answers

The idea of ​​a leader only exists during deployment in an environment update. After the deployment is completed, the concept of leader is no longer

From: https://forums.aws.amazon.com/thread.jspa?messageID=411720񤡈

The link also has some code to implement your own leader, although depending on your needs, it may be easier to understand something else.

+3
source

This is not a feature of AWS EC2 Auto Scaling Groups.

The leader_only attribute is an optional parameter when running container commands on AWS Elastic Beanstalk.

Additionally. Installs an instance in the auto-scaling group as a leader. If leader_only is set to true, the command runs only on the instance marked as leader. The leader runs first.

+2
source

Theoretically, you have two types of leaders:

  1. Leader in Deployment Times
  2. Runtime leader

To set the Deploy-time leader, use leader_only.

To set a leader at runtime, you’re on your own.
Because the instance that was the leader during the deployment,
may not be nearby for various reasons, for example, reduce.
Good solutions do not exist, although some attempts are scattered.

For my own needs, I created a solution that lists all instance IDs, sorts them in alphabetical order, and first selects as a leader.

0
source

Source: https://habr.com/ru/post/1484720/


All Articles