Prerequisites

docker

This workshop assumes you have an environment where docker is installed. If you followed workshop 1, the EC2 instance you deployed already has docker installed and configured. If not, you may follow this setup guide to use docker on your own resources.

Creating an CloudFormation Stack

You may use the following template and parameters to create a CloudFormation stack with an EC2 instance that has docker pre-installed:

You may download these files as-is to create your AWS stack, be sure to change the stack name to something else!:

$ aws configure
AWS Access Key ID [****************QNQG]:
AWS Secret Access Key [****************z5bv]:
Default region name [us-east-1]:
Default output format [json]:
$ aws cloudformation create-stack --template-body file://main.yaml \
  --parameters file://buaws-training-ec2-parameters.json \
  --stack-name ec2-stack-studentXX
{
    "StackId": "arn:aws:cloudformation:us-east-1:438027732470:stack/test-stack-AL/18c...."
}

When your stack creation is complete, you should ssh to the instance using the appropriate private key:

$ ssh -i buawsawstrainec2.pem ec2-user@<IP from cloudformation output>
The authenticity of host 'XX.XXX.XX.XX (XX.XXX.XX.XX)' can't be established.
RSA key fingerprint is 5d:e6:c4:f6:35:a5:9e:85:66:a4:b3:af:56:86:20:93.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'XX.XXX.XX.XX' (RSA) to the list of known hosts.
Last login: Mon Jul 23 16:27:27 2018 from nowhere

       __|  __|_  )
       _|  (     /   Amazon Linux AMI
      ___|\___|___|

https://aws.amazon.com/amazon-linux-ami/2018.03-release-notes/
2 package(s) needed for security, out of 4 available
Run "sudo yum update" to apply all updates.
[ec2-user@ip-172-31-19-57 ~]$