Example: Centralized router - Amazon Virtual Private Cloud

Example: Centralized router

You can configure your transit gateway as a centralized router that connects all of your VPCs, AWS Direct Connect, and Site-to-Site VPN connections. In this scenario, all attachments are associated with the transit gateway default route table and propagate to the transit gateway default route table. Therefore, all attachments can route packets to each other, with the transit gateway serving as a simple layer 3 IP router.

Overview

The following diagram shows the key components of the configuration for this scenario. In this scenario, there are three VPC attachments and one Site-to-Site VPN attachment to the transit gateway. Packets from the subnets in VPC A, VPC B, and VPC C that are destined for a subnet in another VPC or for the VPN connection first route through the transit gateway.

Resources

Create the following resources for this scenario:

Routing

Each VPC has a route table and there is a route table for the transit gateway.

VPC route tables

Each VPC has a route table with 2 entries. The first entry is the default entry for local IPv4 routing in the VPC; this entry enables the instances in this VPC to communicate with each other. The second entry routes all other IPv4 subnet traffic to the transit gateway. The following table shows the VPC A routes.

Destination Target

10.1.0.0/16

local

0.0.0.0/0

tgw-id

Transit gateway route table

The following is an example of a default route table for the attachments shown in the previous diagram, with route propagation enabled.

Destination Target Route type

10.1.0.0/16

Attachment for VPC A

propagated

10.2.0.0/16

Attachment for VPC B

propagated

10.3.0.0/16

Attachment for VPC C

propagated

10.99.99.0/24

Attachment for VPN connection

propagated

Customer gateway BGP table

The customer gateway BGP table contains the following VPC CIDRs.

  • 10.1.0.0/16

  • 10.2.0.0/16

  • 10.3.0.0/16