Follow these steps to configure a transit gateway to communicate between two VPCs that do not have a direct peering relationship:
- Log in to your account and go to the VPC management console.
- Scroll down to the bottom of the menu on the left-hand side of the screen and click Transit Gateways:
Create Transit Gateway
- Click Create Transit Gateway.
- Fill out the Name tag and Description for the transit gateway:
Transit Gateway name and description
- In the Configure the Transit Gateway section, leave the defaults as they are:
Configure the Transit Gateway screen
- Click Create Transit Gateway.
- Immediately after creation, the gateway will be in a pending state:
Gateway pending
- Once the gateway is available, select Transit Gateway Attachments from the left-hand menu and click Create Transit Gateway Attachment:
Create Transit Gateway Attachment screen
- On the following screen, select the transit gateway from the Transit Gateway ID dropdown.
- Give the attachment an Attachment name tag.
- Select one of your VPCs in the VPC ID dropdown.
- Select the subnets from that VPC.
- Click Create Attachment and then repeat steps 9-12 for the other VPC.
- Go to Route Tables under the Virtual Private Cloud menu.
- Choose one of the VPC route tables and add a route for the IP addresses in the other VPC to point to the transit gateway target. Do the same for the other VPC.
- Test the connectivity between the EC2 instances you created in each VPC. Note that the ping command will be blocked by NACL firewall rules that prevent ICMP traffic.
- Once you've finished, delete the Transit Gateway to avoid any future charges.