title: how to attach a EBS volume to my container using docker-compose.yml and ecs-cli
body: <p>I am using <code>docker-compose.yml</code> to define a set of containers. And use <code>ecs-cli compose (service) up</code> to create my application on <code>AWS</code>.</p>
  
  <p>I know <code>AWS ECS</code> comes with 100GB <code>EBS</code> automatically when a container is created. (Even though the <code>EC2</code> instance that hosts the container only have 8GB of hard drive.) 
  I want to have a persistent storage so that even if I updated my container, it can still point to the same 100GB <code>EBS</code>. I am pretty sure I can do the following to achieve this goal:</p>
  
  <blockquote>
    <p>Attach an external <code>EBS</code> to the EC2 instance, and use <code>volume</code> in the
    compose file to attach that volume to the container.</p>
  </blockquote>
  
  <p>However, I feel there might be a better way to do so on ECS since it gives you 100GB ELB automatically. That is, if I use the above approach, then I am really 'wasting' the 100GB volume that comes with each container.
  So, what is the best way to achieve this. Could you give an answer in the form of a docker-compose.yml format like the following?</p>
  
  <pre><code>container1:
    image: image1
  
  container2:
    image: image2
    links:
      - "container1"
  </code></pre>