AWS Elastic Beanstalk - why would I use leader_only for a command?

前端 未结 1 1575
日久生厌
日久生厌 2021-02-19 01:14

I am writing a django app which I plan on deploying to AWS via Elastic Beanstalk. I am trying to understand why I would need to specify \'leader_only\' for a container command I

1条回答
  •  温柔的废话
    2021-02-19 01:15

    From a technical point of view, elastic beanstalk is autoscaling group and when you deploy something you need to assume that potentially your commands can be executed simultaneously on several ec2 instances.

    Main goal of the leader_only option is to make sure that your commands will be executed on only one ec2 instance. It is useful for use cases such as execution of the db migration scripts, creation of db, etc., that should be executed just once on one ec2. So leader_only is just a marker that some commands will be executed on this instance only.

    However, you need to keep in mind, the leader attribute is set once on creation of your environment and in case if leader died and was replaced by new instance possible situation when you don't have any leaders in autoscaling group.

    0 讨论(0)
提交回复
热议问题