title: AWS Elastic Beanstalk - why would I use leader_only for a command?
body: <p>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 want to run for my app. More details about this can be found <a href="http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html">here</a>. </p>
  
  <p>It says:</p>
  
  <blockquote>
    <p>Additionally, you can use leader_only. One instance is chosen to be
    the leader in an Auto Scaling group. If the leader_only value is set
    to true, the command runs only on the instance that is marked as the
    leader.</p>
  </blockquote>
  
  <p>If I have several instances running my app because I want to scale it, wouldn't using 'leader_only' run the command on only one instance, and not affect the rest? I am probably misunderstanding the purpose of it, but that seems non-ideal because the environment in the leader may differ from the other instances, and the end user may get different results depending on which instance they happen to connect to.</p>