Setting up an EC2 Instance - SamirTalwar/the-tiniest-service GitHub Wiki

  1. Create an Amazon Linux instance.

  2. Open the following ports:

    Service Protocol Port Range
    SSH TCP 22
    DNS UDP 53
    Docker HTTP API TCP 2375
    Docker ports TCP 32768-61000
    Consul Server RPC TCP 8300
    Consul Serf LAN TCP & UDP 8301
    Consul Serf WAN TCP & UDP 8302
    Consul CLI RPC TCP 8400
    Consul HTTP API TCP 8500
    Consul DNS TCP & UDP 8600
  3. Download the PEM file.

  4. Set an Elastic IP.

  5. Set up the SSH credentials locally in ~/.ssh/config:

     Host $ALIAS
         HostName $PUBLIC_HOSTNAME
         User ec2-user
         IdentityFile $PEM_FILE_ABSOLUTE_PATH
    
  6. SSH in using ssh $ALIAS.

  7. Update everything using sudo yum update.

  8. Install Docker using sudo yum install docker.

  9. Add the ec2-user to the docker group using sudo usermod -G ec2-user,wheel,docker ec2-user or similar.

  10. Add the following line to /etc/sysconfig/docker:

    OPTIONS='-H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375'
    
  11. Start Docker using sudo service docker start.