Down to dirty blog on setting up VPC with terraform.
This is to setup a new VPC in ap-south-1 with three public and three private subnets. It'll also take care of NAT Gateways, Internet Gateways, etc.
What the script does/creates:
- There is 1 vpc in ap-south-1
- There are 3 Availability zones, marked as 1a,1b,1c. To take advantage of multi AZ setup, we've 1 private subnet and 1 public subnet in each AZ. (total 6 subnets)
- Each private subnet needs to talk to internet via NAT gateway. We're using 1 NAT gateway per AZ.
- The script takes care of appropriate route table associations and ACL rules.
- To launch an internal services like kibana, sentry, etc. and public facing Load balancers we use public subnets.
- For the rest, we use private subnets for all services that aren't exposed to internet, databases, etc.
Terraform Files are here:
Put them all in a folder, change terraform.tfvars with your own AWS credentials.
terraform apply say
yes once you see what's being created.