title: Configuring hostname for memcached on EC2 instances
body: <p>I'm using Memcached on each of my EC2 web server instances. I am not sure how to configure the various hostnames for the memcache nodes at the server level.</p>
  
  <p>Consider the following example:</p>
  
  <pre><code>&lt;?php 
  $mc = new Memcached() 
  $mc-&gt;addServer('node1', 11211); 
  $mc-&gt;addServer('node2', 11211); 
  $mc-&gt;addServer('node3', 11211);
  </code></pre>
  
  <p>How are <code>node1</code>, <code>node2</code>, <code>node3</code> configured?</p>
  
  <p>I've read about a few setups to configure the instance with <code>hostname</code> and update <code>/etc/host</code> with these entries. However, I'm not familiar enough with configuring such things.</p>
  
  <p>I'm looking for a solution that scales - handles adding and removing instances - and automatic.</p>