Skip to content

Quickly land a free AWS EC2 instance with docker installed

Notifications You must be signed in to change notification settings

terraformed/terraform-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker via Terraform on AWS

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.

Prerequisites

Install Terraform and Git. I suggest using chocolatey for Windows or homebrew for Mac.

Getting Started

  1. Create AWS account
  2. 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.
  3. 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.

Installation

  1. Clone Repo and run terraform init
    git clone https://github.com/terraformed/terraform-docker.git
    cd ./terraform-docker
    terraform init
    
  2. 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
    
  3. 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
    

Acknowledgments:

About

Quickly land a free AWS EC2 instance with docker installed

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published