1. Home
  2. Training Library
  3. Amazon Web Services
  4. Courses
  5. Working with AWS Networking and Amazon VPC

NAT Gateway


VPC Fundamentals
What is a VPC?
16m 20s
VPC Security and Control
VPC Connectivity
5m 35s

The course is part of these learning paths

Solutions Architect – Professional Certification Preparation for AWS
course-steps 48 certification 6 lab-steps 19 quiz-steps 4 description 2
SysOps Administrator – Associate Certification Preparation for AWS
course-steps 35 certification 5 lab-steps 30 quiz-steps 4 description 5
AWS Networking & Content Delivery
course-steps 7 certification 2 lab-steps 5
AWS Advanced Networking – Specialty Certification Preparation
course-steps 20 certification 2 lab-steps 8 quiz-steps 4
Fundamentals of AWS
course-steps 6 certification 6 lab-steps 6 description 2
Operations on AWS
course-steps 6 certification 2 lab-steps 3
more_horiz See 4 more
Start course
Duration1h 17m
star star star star star-half


This course has been designed to give you an overview of the AWS Virtual Private Cloud and its associated networking components.  This will help you to architect and build your VPC for a variety of different workloads and use cases.  The topics covered within this course include:

  • Virtual Private Clouds (VPCs)
  • Subnets
  • Route Tables
  • Network Access Control Lists (NACLs)
  • Security Groups
  • NAT Gateways
  • Bastion Hosts
  • VPN and Direct connection
  • VPC Peering
  • AWS Transit Gateway

Who should attend this course?

  • Those who are relatively new to AWS to gain a better understanding of how to construct and architect virtual private cloud

  • Those looking to learn more about AWS networking features and components

  • Those studying for the AWS solutions architect certifications 

Course Objectives

  • Confidently architect a VPC across multiple availability zones within a Region
  • Explain different networking components commonly used within AWS VPCs
  • Secure your VPCs, helping you to protect your resources within them
  • Assess which method of connectivity to your VPCs would be best in different scenarios


To get the most from this course then you should have some exposure to AWS, for example, EC2, however, this is not essential.


Resources referneced within this lecture:

AWS Shared Responsibility Model



I now want to talk to you about another VPC component, and that is the NAT gateway. To help explain what this does, let me just draw out our VPC quickly. So we have a very simple VPC, and we're gonna have two subnets in this VPC, we'll have a public subnet and also we'll have a private subnet as well, and it's the private subnet that we're going to be focusing on. 

So this will be our public, and the green one will be our private subnet. Now obviously we'll have an Internet gateway attached to our VPC, which will then connect out to the Internet. Okay, so we have a public subnet, and a private subnet. Now in our private subnet we'll have a number of EC2 instances running our applications, and in our public subnet we're likely to have a number of web servers as well. As we know, each of these subnets also have a route table attached. Public route table will have access to the Internet gateway, and also to the other private subnet. 

Now we need to start thinking about security again. Now, looking at our EC2 instances in the private subnet, we are responsible, as a part of the AWS Shared Responsibility Model, to update and patch the operating systems running on each of our EC2 instances. Now if you're not familiar with the AWS Shared Responsibility Model, I suggest you take a look at it. It's critical to all of your AWS deployments, and it essentially defines the boundaries of security as to what your roles and responsibilities are of implementing security within the cloud, and what AWS's responsibility is of maintaining security of the cloud. For more information, you can take a look at this blog post here. 

Okay, so with that in mind, if we have the responsibility of maintaining the operating systems of our EC2 instances, then we need to be able to download updates as and when we need to. However, this subnet is private. Meaning it has no access to the Internet gateway, and therefore the Internet, so how can we download those updates? Well, what we can do, we can add a NAT gateway. 

Now, a NAT gateway sits within the public subnet. Because it sits within the public subnet, it has to have a public IP address in the form of an EIP which is an Elastic IP address, and this is assigned to the instance itself. Now because it sits within the public subnet, it has a route out to the Internet gateway, and to the Internet. Now once we have our NAT gateway set up and configured, we need to update the route table of our private subnet. Now, by default our route table in our private subnet will just have the local route that all route tables have. But if we update that to provide a route to the NAT gateway, and we can see that I've added this additional route in here. Now this looks very familiar to the route we added to the public subnet to get access to the Internet via the Internet gateway, and it is essentially the same. So we'll add the which is essentially a destination to any IP address unknown in the route table already. Then, send it to the target of the NAT gateway. And they can tell it's a NAT gateway as this first part here, is prefixed with nat. And then this section along here, is essentially the ID of the NAT gateway within your VPC. 

So what this route table is telling us, is that if any resource within this subnet needs to gain access to the Internet to perform an update, then it can do so via our NAT over here. This NAT gateway will then take the request, go via the Internet gateway, and download the appropriate software that's required, and send it back to the EC2 instance requesting it. Now the important thing with a NAT gateway, is that it will not accept any inbound communication initiated from the Internet. It will only accept outbound communications originating from within your VPC. So it will deny all inbound traffic that's been initiated from the Internet. 

Now the NAT gateway itself is managed by AWS, so you don't have to provision the instance itself. It's very easy to do, you simply create the NAT gateway, specify what subnet it should reside in, and associate an Elastic IP address, and AWS will manage all other configuration. Because it's managed by default, AWS will set up multiple NAT gateways for resiliency, but you'll only see the one NAT gateway within your account with the associated ID. 

Now, earlier I mentioned about configuring your resources across Multi-Availability Zones. So if you have multiple public subnets in different Availability Zones, you will need to set up another NAT gateway within that subnet as well. AWS will not automatically deploy a NAT gateway within each of your public subnets. 

So just as a quick summary, a NAT gateway allows instances within a private subnet access to the Internet, but the NAT gateway itself will block all incoming initiations from the Internet. So it protects the private subnet in that way. And this allows you to ensure that you maintain the security of your EC2 instances ensuring that their OS is kept up to date, and any patch management is taken care of as well. Now the next component I want to talk to you about is the bastion host. So let's take a look.

About the Author

Learning paths43

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

To date, Stuart has created 60++ courses relating to Cloud, most within the AWS category with a heavy focus on security and compliance

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.