Skip to content

Latest commit

 

History

History
30 lines (16 loc) · 2.38 KB

File metadata and controls

30 lines (16 loc) · 2.38 KB

Network Stack on AWS

Goal

Learn how to manage Network Stack on AWS which consists of VPC resources (subnets, routes, routing tables, NAT gateways, VPC endpoints, etc) using Terraform AWS VPC module published in Terraform Registry.

Integrate VPC with other resources (eg., autoscaling, security group).

Tasks

  1. Explore Terraform Registry - https://registry.terraform.io.
  2. Explore examples of using terraform-aws-vpc module.
  3. Using terraform-aws-vpc module create VPC for the real scenario (eg, 3 public subnets, 3 private subnets, single NAT gateway).
  4. Using terraform-aws-autoscaling module create an autoscaling group which will always have 1 EC2 instance running in public subnet. Install and run nginx service when instance starts.
  5. Using terraform-aws-security-group module create a security group for EC2 instances where HTTP and SSH ports are open.

Solutions

Solutions are inside solutions/1-network directory.

Extra tasks

  1. Extend your solution to make use of Terraform 0.12 expressions and make VPC resources to span across all availability zones available for you (replace hard-coded values in lists with for expressions and cidrsubnet() functions)

  2. Create SSH key-pair to be able to SSH to instances. Create TLS private key using RSA algorithm, and use it to create EC2 key pair. Update launch configurations to launch instances using correct key_name.

  3. Using terraform-aws-elb module create a public-facing Elastic Load Balancer which will stay in front of EC2 instances launched by an autoscaling group.