Routing: Internet Gateways & NAT Gateways


VPC Fundamentals
What is a VPC?
VPC Security and Control
VPC Connectivity
VPC Sharing using the AWS Resource Access Manager
Feature Spotlight:
Start course
3h 12m

In this section of the AWS Certified Advanced Networking - Specialty learning path, we introduce you to the various networking and VPC services currently available in AWS that are relevant to the ANS-C01 exam.

Learning Objectives

  • Identify and describe the various networking services available in AWS
  • Describe how to configure an Amazon Virtual Private Cloud (VPC)
  • Understand how to control network traffic via Security Groups and Network Access Control Lists (NACLs)
  • Describe options for VPC connectivity, subnets, and routing
  • Understand how to share VPC resources using the AWS Resource Access Manager (RAM)
  • Identify how to evaluate the configuration of VPC resources using the VPC Reachability Analyzer


The AWS Certified Advanced Networking - Specialty certification has been designed for anyone with experience designing, implementing, and operating complex AWS and hybrid networking architectures. Ideally, you’ll also have some exposure to the nuances of AWS networking, particularly regarding the integration of AWS services and AWS security best practices. Many exam questions will require advanced level knowledge of many AWS services, including AWS networking services. The AWS Cloud concepts introduced in this course will be explained and reinforced from the ground up.


Hello, and welcome to this lecture, where I want to look at how to configure routing for both internet gateways and NAT gateways. In a previous lecture, I talked about public and private subnets and how a public subnet is defined. A part of this public subnet definition is an association of an internet gateway.

This internet gateway, or IGW, as it's known, provides a means of communicating out to the internet. This internet gateway is aservice, controlled, configured, and maintained by AWS. It scales horizontally automatically and is classified as a highly available component of your VPC infrastructure. Once your internet gateway's attached to your VPC, you have a gateway to the internet.

Now you need to configure the subnet's route table to point to this internet gateway, and therefore, makin' it a public subnet. Often, the route is configured as follows. The destination value of 0.0.0. 0/0 essentially implies that for any destinations that are not known by the route table, then use this route, which has a target pointing out to the internet gateway.

It's essentially used as a catch-all, if no other route exists. However, the destination for the internet gateway doesn't always have to point to all other destinations. You can have a destination pointing to a specific IP out on the internet, or to a specific range if required. You may need to do this for security and compliance reasons.

Any subnet which has a route table associated that points to an internet gateway is considered a public subnet, as it has connectivity out to the internet. Routing for a NAT gateway is slightly different, but also requires the use of a public subnet to be configured. To briefly explain, a NAT gateway allows instances within a private subnet access out to the internet; however, access to the instances within these private subnets cannot be initiated from the internet.

This diagram shows a VPC with two subnets, one public, and one private, The public subnet is configured with a route to the internet gateway and can access the internet as required. Instances in the private subnet, which are kept private for security reasons, but still need access to the internet for important operating system updates, and so need to be able to initiate a route to the internet.

The route table for the private subnet has a very similar route to the public subnet, in that they both have a destination route to The private subnet, however, has a route to the NAT gateway instead, which is located within the public subnet. From here, the NAT gateway will provide internet connectivity.

From a design perspective, if you had multiple availability zones but only one NAT gateway configured, and the AZ went down which held the NAT gateway, all of your other private subnets across all AZs would not be able to connect to the internet. To resolve this, configure a public subnet in each AZ and update the route tables for all the private subnets in that availability zone to point to the new NAT gateway.

That way, if any AZ goes down, it will not affect the internet access for private instances within other AZs, as this will now be AZ-independent.

Coming up in the next lecture, routing configurations for VPC endpoints.

About the Author
Learning Paths

Stuart has been working within the IT industry for two decades covering a huge range of topic areas and technologies, from data center and network infrastructure design, to cloud architecture and implementation.

To date, Stuart has created 150+ courses relating to Cloud reaching over 180,000 students, mostly within the AWS category and with a heavy focus on security and compliance.

Stuart is a member of the AWS Community Builders Program for his contributions towards AWS.

He is AWS certified and accredited in addition to being a published author covering topics across the AWS landscape.

In January 2016 Stuart was awarded ‘Expert of the Year Award 2015’ from Experts Exchange for his knowledge share within cloud services to the community.

Stuart enjoys writing about cloud technologies and you will find many of his articles within our blog pages.