title: How to pull ECS docker image from an EC2 instance?
body: <p>What is the best practice to pull a Docker image located in a repository in ECS from an EC2 instance?</p>
  
  <ul>
  <li>I pushed Docker images into my repository located under ECS.</li>
  <li>I would like to launch an EC2 instance and pull these images from it.</li>
  </ul>
  
  <p>I am used to take advantage of the ECS task. To just run a Docker container for 5min, I need to go to <code>Auto-Scale</code>, set the minimum at <code>1</code>, go to the ECS page, wait for an instance to be up and run my task. Too annoying for my personal use. I'd like to run it quickly and stop it quickly.</p>
  
  <p>I wanted to simply run my Docker container but ok, that's not possible, then I am thinking of creating an EC2 template that will directly run my Docker container inside an EC2 instance.</p>
  
  <ul>
  <li>How to do it?</li>
  <li>How can I handle the keys/users and the AWS CLI inside my EC2? (Access/Secret Access Key are limited to 30min, I can't write it clearly in the <code>User Data</code> of an EC2 instance/template)</li>
  </ul>
  
  <p>I think my need is very basic and I couldn't find the best way to do it. Blog articles mainly explain how to run Docker on Linux, not the best way to do it on AWS.</p>