This repository is the near-simplest example of deploying an provisioning a web server on Amazon Web Services (AWS), using Terraform and Ansible. Based on:
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 2
- 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
.
export AWS_DEFAULT_REGION=us-east-1
./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.