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?
Two VPCs with multiple CIDRs peered togetherYou can add IPv4 CIDR blocks to your VPC. In this example, VPC A and VPC B have multiple IPv4 CIDR blocks. The route tables for each VPC point to the VPC peering connection to access all the IPv4 CIDR blocks of the peer VPC.
You cannot have multiple subnets with the same (or overlapping) CIDR blocks in the same VPC, though, because AWS treats it as one continuous network.
Within a VPC, route tables are assigned to individual subnets. With only 1 route table created in a VPC, all of the subnets would be assigned to that route table. You can create multiple route tables in a VPC, or you can leave the 1 default route table.
VPC A and VPC M have overlapping CIDR blocks. This means that peering traffic between VPC A and VPC C is limited to a specific subnet (subnet A) in VPC C. This is to ensure that if VPC C receives a request from VPC A or VPC M, it sends the response traffic to the correct VPC.
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.
Then:
0.0.0.0/0
route that points to NAT Gateway 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With