title: How to setup ElasticSearch cluster with auto-scaling on Amazon EC2?
body: <p>There is a great tutorial <a href="https://web.archive.org/web/20150109115804/http://www.elasticsearch.org/tutorials/elasticsearch-on-ec2" rel="noreferrer" title="elasticsearch on ec2">elasticsearch on ec2</a> about configuring ES on Amazon EC2. I studied it and applied all recommendations.</p>
  
  <p>Now I have AMI and can run any number of nodes in the cluster from this AMI. Auto-discovery is configured and the nodes join the cluster as they really should.</p>
  
  <p>The question is <strong>How to configure cluster in way that I can automatically launch/terminate nodes depending on cluster load?</strong></p>
  
  <p>For example I want to have only 1 node running when we don't have any load and 12 nodes running on peak load. But wait, if I terminate 11 nodes in cluster what would happen with shards and replicas? <strong>How to make sure I don't lose any data in cluster if I terminate 11 nodes out of 12 nodes?</strong></p>
  
  <p>I might want to configure <a href="http://www.elasticsearch.org/guide/reference/modules/gateway/s3/" rel="noreferrer" title="s3 gateway">S3 Gateway</a> for this. But all the gateways except for local are deprecated.</p>
  
  <p>There is an article in the manual about <a href="http://www.elasticsearch.org/guide/reference/index-modules/allocation/" rel="noreferrer" title="allocation">shards allocation</a>. May be I'm missing something very basic but I should admit I failed to figure out if it <strong>is possible to configure one node to always hold all the shards copies</strong>. My goal is to make sure that if this would be the only node running in the cluster we still don't lose any data.</p>
  
  <p>The only solution I can imagine now is to configure index to have 12 shards and 12 replicas. Then when up to 12 nodes are launched every node would have copy of every shard. But I don't like this solution cause I would have to reconfigure cluster if I might want to have more then 12 nodes on peak load.</p>