1. Home
  2. Training Library
  3. Designing Secure solutions in AWS - Level 2

AWS Default Routing

Instructor: Mike Brown

AWS Default Routing

In this lecture we will discuss VPC default routing. When you create a VPC, an implicit router is created for you. You cannot see this router but it’s there. This router is connected to each VPC subnet and addressed by using the first IP address of each subnet. 

We interact with this router by using route tables. When created, each VPC has a default route table. This route table will contain targets identified as local, here you can see an example of this.

alt  

The local target is used for all packets going through the router that has a destination address matched by the 10.0.0.0/16 entry.  10.0.0.0/16 is the IPv4 CIDR block assigned to our VPC from which all of the VPC subnets will obtain their address ranges.

This local entry can not be altered and it can not be deleted. This local entry means that EC2 instances deployed to different subnets in the same VPC will be able to route to each other.

But what if EC2 instances want to be able to route to the internet, how will that affect our route tables?

Instances in Public subnets

To allow instances in public subnets who also have public IP addresses to route traffic to the internet we need to.

  1. Request an internet gateway for our VPC.

  2. Adjust the route table to route traffic through the internet gateway.

Here is an example of what the route table would look like when configured to use an internet gateway.

alt

Here we can see that we have added a default IPv4 route of 0.0.0.0/0 that sends traffic to the internet gateway igw-0a976dfbefbc34d27. An internet gateway must be requested and attached to the VPC in order for it to appear as a target in our route table.

Now any traffic that matches 10.0.0.0/16 will be sent locally and everything else (0.0.0.0/0) will be sent through the internet gateway.

What about IPv6?

Well IPv6 works in the same way. Here is an example of local routing of IPv6 and routing IPv6 through an internet gateway:

alt

Instances in Private subnets

To allow instances in private subnets who only have private addresses to access the internet we typically use a NAT Gateway. The NAT Gateway is deployed to a public subnet so that it can use the Internet Gateway to access the internet. We then:

  1. Create a new route table.

  2. Associate the Private Subnets with the new route table.

  3. Add a route that routes internet traffic through the NAT Gateway.

This is how the route table might look:

alt

Here we see the default route 0.0.0.0/0 but this time traffic that matches 0.0.0.0/0 is sent to target nat-0b52733b65347a196, the NAT Gateway deployed to a public subnet.

We have then used the Subnet Associations tab and explicitly associated our private subnets with this route table.

alt

Subnets can only be associated with one route table at a time so by associating the private subnets with this route table we are removing their association with the default route table.

In every VPC, 1 route table is designated the Main route table. This is the route table that all new subnets are associated with. Because of this and to reduce the chances of new students being given access to routes that they shouldn't be able to use, it is recommended that the main route table only contains the local route.

What about IPv6?

Routing IPv6 traffic to the internet from a private subnet works slightly differently than IPv4. IPv6 traffic from a private subnet is routed through an Egress Only Internet Gateway.  Egress Only Internet Gateways work just like a NAT Gateway but for IPv6 traffic instead of IPv4.

You request an Egress Only Internet Gateway in the same way you request an Internet Gateway and attach it to your VPC. You then edit a route table to use it. Here is an example of a route table configured to use an Egress Only Internet Gateway 

alt

 

Difficulty
Intermediate
Duration
2h 45m
Description

This course covers the core learning objective to meet the requirements of the 'Designing secure solutions in AWS - Level 2' skill

Learning Objectives:

  • Analyze the available options to secure credentials using features of AWS Identity and Access Management (IAM)
  • Evaluate the appropriate routing mechanism to securely access AWS service endpoints or internet-based resources from an Amazon VPC
  • Evaluate the appropriate encryption options available for data in transit and when at rest across AWS services
  • Evaluate the most appropriate key management service and options based on business requirements and governance controls

 

About the Author
Students
207212
Labs
1
Courses
211
Learning Paths
163

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.