Setting up an EC2 Instance - SamirTalwar/the-tiniest-service GitHub Wiki
-
Create an Amazon Linux instance.
-
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 -
Download the PEM file.
-
Set an Elastic IP.
-
Set up the SSH credentials locally in
~/.ssh/config
:Host $ALIAS HostName $PUBLIC_HOSTNAME User ec2-user IdentityFile $PEM_FILE_ABSOLUTE_PATH
-
SSH in using
ssh $ALIAS
. -
Update everything using
sudo yum update
. -
Install Docker using
sudo yum install docker
. -
Add the ec2-user to the
docker
group usingsudo usermod -G ec2-user,wheel,docker ec2-user
or similar. -
Add the following line to
/etc/sysconfig/docker
:OPTIONS='-H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375'
-
Start Docker using
sudo service docker start
.