This repository sets up:
-
A VPC
-
A subnet
-
An internet gateway
-
A security group
-
An SSH key pair
-
A publicly-accessible EC2 instance
-
Within the instance:
- Python 2 (for Ansible)
- Nginx
- Install the following locally:
- Terraform >= 0.10.0
- Terraform Inventory
- Python (see requirements)
- pip
- Set up AWS credentials in
~/.aws/credentials
.- The easiest way to do so is by setting up the AWS CLI.
- Ensure you have an SSH public key at
~/.ssh/id_rsa.pub
.
Install:
Once installed, create a workspace, configure the GOPATH and add the workspace's bin folder to your system path:
$ mkdir $HOME/go
$ export GOPATH=$HOME/go
$ export PATH=$PATH:$GOPATH/bin
Next, install terraform-inventory
$ go get -u github.com/jijeesh/terraform-inventory
##Generating a new SSH key
ssh-keygen -t rsa -b 4096 -C "[email protected]"
./deploy.sh
More information about the AWS environment variables. If it is successful, you should see an address
printed out at the end. Visit this in your browser, and the page should say "Welcome to nginx!"
./deploy.sh
is idempotent.- Information about overriding the Terraform variables.
cd terraform
terraform destroy