startup-systems / terraform-ansible-example

Terraform+Ansible Example

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Terraform+Ansible Example

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:

Details

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

Setup

  1. Install the following locally:
  2. Set up AWS credentials in ~/.aws/credentials.
  3. Ensure you have an SSH public key at ~/.ssh/id_rsa.pub.

Usage

export AWS_DEFAULT_REGION=us-east-1
pip install -r requirements.txt

./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!"

Notes

Cleanup

cd terraform
terraform destroy

About

Terraform+Ansible Example

License:MIT License


Languages

Language:HCL 88.0%Language:Shell 12.0%