In this hands-on lab, we will create a highly-available multi-subnet VPC and subnet structure for private application servers. We’ll then configure a bastion host so that remote administrative staff can securely connect into the VPC and manage the private instances. Since these instances will require outbound access for security patches and updates, we will create and configure a NAT gateway to allow it.
Our task is to create the VPC with public and private route tables. The VPC’s CIDR, `192.168.0.0/24`, has been subnetted. Our new CIDR block `/26` allows for a maximum of 4 subnets. We will create 2 public and 2 private subnets.
Then, we will create the NACL and security group rules to support the bastion host, private instances, and NAT gateway. Once that’s done, we’ll validate the connectivity for our bastion host by creating an SSH tunnel through it to our private instance. Once we’re in, we will verify that our private instance can connect to the internet.
There is a lot to do in this hands-on lab, so let’s get started.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Create the VPC Skeleton
- Create a VPC named ATD_VPC with a CIDR block of
192.168.0.0/24
. - Within the VPC, create 4 subnets using the CIDR block
/26
.
- Create a VPC named ATD_VPC with a CIDR block of
- Create an Internet Gateway and a Public and Private Route Table
- Create an internet gateway and attach it to the VPC.
- Create a public route table named ATD_PublicRT with a default route to the internet gateway.
- Create a private route table named ATD_PrivateRT with a destination CIDR block of
192.168.0.0/24
.
- Configure the Bastion Host
Create the NACLs named ATD_Public1 and a security group named ATD_Bastion-SG with the appropriate configuration for the bastion host.
Set up the bastion host Amazon EC2 instance with the name tag BastionHost and verify connectivity using SSH.
- Create an Amazon EC2 Instance in the Private Subnet
Create the NACLs and security group configuration necessary to support SSH connectivity between the bastion host and an Amazon EC2 instance in the private subnet.
Create an instance in the private subnet with the name tag PrivateAppServer and verify SSH connectivity from the bastion host.
- Set Up the NAT Gateway and Validate Connectivity
Create the NACLs required for the NAT gateway subnet.
Create the NAT gateway and set it as the target for the default route in the private route table.
Verify connectivity to the internet from the private EC2 instance.