I've created this document just in case the original one (https://gist.github.com/npearce/6f3c7826c7499587f00957fee62f8ee9) get deleted.
sudo yum update -y
sudo amazon-linux-extras install docker -y
sudo service docker start
sudo usermod -a -G docker ec2-user
sudo chkconfig docker on
sudo yum install -y git
sudo reboot