Create a Multi-Subnet VPC with Secure Access to Private Servers with Outbound Internet Access

1 hour
  • 5 Learning Objectives

About this Hands-on Lab

In this Hands-On Lab we will create a multi-subnet highly-available VPC and subnet structure for private application servers. We’ll 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 NAT Gateway to allow it.

Our task is to create the VPC with public and private route tables. The VPC’s CIDR,, has been subnetted. Our new CIDR /26 allows for a maximum of four subnets. We will create two public and two 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 four subnets.

Create the Internet Gateway, then a public and a 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 and create a private route table named ATD_PrivateRT.

Configure the bastion host

Create the NACLs named ATD_Public1 and 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.

Additional Resources

Please make sure you are in the us-east-1 region.

The interactive diagram, showing the rules that we will create, is here:

Windows Users: Please use the instructions below when prompted during the video lessons:

For instructions on connecting to a Amazon Linux instance using Putty on a Windows computer, please use the following video lesson:

As an alternative to PuTTY, WSL2 can be used. You can find setup steps here:

If you are using a Windows computer and need instructions on configuring the ssh-agent, please use these instructions:

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?