This is a example terraform template to build vpc and install NGINX. This template will create following resources.
- VPC
- Public Subnet - 1
- Private Subnet - 2
- Internet Gateway
- NAT Gateway
- Route Tables
- ELB
- Security Groups
- Bastion Host/ Jump Server
- EC2 Instances
- Install NGINX
- Attach Instances to ELB
- Setup CloudWatch SNS email alerts
.tf file
contains all the resource configuration for the tasks given. Terraform officially doesn't support email protocol for SNS notification. I have used a module which runs a cloudformation template to create the email SNS notification.
main.tf
: main file which needs to be runuserdata.sh
: this script will be run under userdata property to install nginx.
git clone git@github.com:amjad489/terraform-vpc.git
cd <path to .tf file>
terraform init
terraform plan
terraform apply