title: ElasticSearch on Elastic Beanstalk
body: <p>I'm trying to get ElasticSearch running in an Elastic Beanstalk environment. Using Docker image it's fairly straightforward to get one instance running in a load balanced environment. However, when I try to add more instances to the cluster, they fail to discover each other and every new one becomes a new_master.</p>
  
  <p>My <code>Dockerfile</code> looks like following</p>
  
  <pre><code>FROM dockerfile/java:oracle-java8
  RUN ... # Downloading and installing ElasticSearch
  RUN /elasticsearch/bin/plugin install elasticsearch/elasticsearch-cloud-aws/2.5.0
  VOLUME ["/data"]
  ADD config/elasticsearch.yml /elasticsearch/config/elasticsearch.yml
  WORKDIR /data
  CMD ["/elasticsearch/bin/elasticsearch"]
  
  EXPOSE 9200
  </code></pre>
  
  <p>And the configuration <code>config/elasticsearch.yml</code> looks like following:</p>
  
  <pre><code>cluster:
    name: elastic-env-dev
  cloud:
    aws:
      region: ap-southeast-2
  discovery:
    type: ec2
    ec2:
      tag:
        Name: elastic-env-dev
      ping_timeout: 120s
  </code></pre>
  
  <p>The name of the EB environment is <code>elastic-env-dev</code>.</p>