masterforker
masterforker

Reputation: 2527

Multiple AWS routes with same Destination Cidr Blocks

I'm trying to create two routes for two nat gateways that live in separate subnets. Is there a reason why they can't have a destination cidr block of 0.0.0.0/0?

Upvotes: 6

Views: 2537

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269881

I presume that you are wanting to create a Highly Available network that is using multiple NAT Gateways in separate Availability Zones.

This is a common design requirement. Amazon EC2 instances in a private subnet that wish to communicate with the Internet require a route to a NAT Gateway (or a NAT Server). To remain highly available, you will need a NAT Gateway in each Availability Zone and a different route table for each Availability Zone.

Highly Available VPC with multiple NAT Gateways

Then:

  • The Route Table for the private subnet in Availability Zone A would have a 0.0.0.0/0 route that points to NAT Gateway A.
  • The Route Table for the private subnet in Availability Zone B would have a 0.0.0.0/0 route that points to NAT Gateway B.

Each route table can only have one entry for a given CIDR range. The VPC selects the most-restrictive CIDR range that matches, so the 0.0.0.0/0 entry will be the last one referenced.

Upvotes: 8

Related Questions