This project will leverage AWS to quickly land a debian ec2 instance with docker installed. A security group with ports 22, 80, and 443 allowed inbound are created on terraform apply as well. This instance should be free for 12 months if done with AWS free tier.
Install Terraform and Git. I suggest using chocolatey for Windows or homebrew for Mac.
- Create AWS account
- Create IAM user
- Select Programmatic access for access type
- Give the user 'AdministratorAccess' policy or create a Admin group with 'AdministratorAccess' and add that user to it.
- After creating the user you will get the access key ID and secret access key. You will need these for our secret.tfvars file.
- Create a key pair called ec2keys and save subsequent ec2keys.pem to this project location. Possible restrictions creating key pair within EC2 dashboard for the first 24 hours of AWS account creation.
- Clone Repo and run terraform init
git clone https://github.com/terraformed/terraform-docker.git cd ./terraform-docker terraform init
- Copy and edit secret.tfvars.example to secret.tfvars, input your IAM user key and secret and run the following:
terraform plan -var-file='secret.tfvars' terraform apply -var-file='secret.tfvars' -auto-approve
- Log into AWS by using the output value of 'aws_instance_public_dns'
ssh -i <key location> admin@<ec2 public dns entry> example: ssh -i ec2keys.pem admin@ec2-52-234-127-217.compute-1.amazonaws.com
- Referenced this blog by Phillip Shipley
- Watched some of Ned Bellavance Getting Started with Terraform on Pluralsite