How to connect VPCs using Transit Gateway
Introduction
Transit Gateway is an important tool for efficiently managing network routing and security in large-scale network environments. It allows an easy establishment of communication between VPCs, and between VPCs and on-premises networks, enabling traffic aggregation and centralized management of security policies.
In this guide, we will provide a detailed explanation of how to connect VPCs using Transit Gateway.
How to built a Transit Gateway
(1) Creating a Transit Gateway
Select “VPC” from the services menu in the AWS Management Console. From the VPC dashboard, click on “Transit Gateway“. Click on “Create Transit Gateway” to proceed to the Transit Gateway creation page.
![](http://www.atmarksol.jp/wp-content/uploads/2023/06/image-114-549x360.png)
![](http://www.atmarksol.jp/wp-content/uploads/2023/06/画像1-10.png)
Set an arbitrary name in the “Name tag” field, and choose the VPN settings according to your environment. Uncheck the options for automatic association and propagation creation to disable them. After making your selections, click on “Create Transit Gateway” at the bottom right.
![](http://www.atmarksol.jp/wp-content/uploads/2023/06/画像2-5-333x360.png)
If the “State” turns into “Available“, the creation in complete.
![](http://www.atmarksol.jp/wp-content/uploads/2023/06/画像3-4.png)
(2) Creating a Transit Gateway Route Table
From the VPC dashboard, click on “Transit Gateway Route Tables” and then click on “Create Transit Gateway Route Table” to navigate to the page for creating a Transit Gateway Route Table.
![](http://www.atmarksol.jp/wp-content/uploads/2023/06/画像4-7-527x360.png)
Set any desired name for the “Name tag” field, and select the Transit Gateway you created in step (1) for the “Transit Gateway ID“. Once selected, click on “Create Transit Gateway Route Table” at the bottom right.
![](http://www.atmarksol.jp/wp-content/uploads/2023/06/画像5-4.png)
(3) Creating a connection from VPC to Transit Gateway
Click on “Transit Gateway Attachments” from the VPC Dashboard, and then click on “Create Transit Gateway Attachment” to proceed to the Transit Gateway Attachment creation screen.
![](http://www.atmarksol.jp/wp-content/uploads/2023/06/画像6-6.png)
For the “Transit Gateway ID“, select the Transit Gateway created in step (1). Choose “VPC” for the “Attachment Type“. Set an arbitrary name for the “Name tag“. Select the relevant Availability Zone and choose any desired subnet for each zone in VPC1. Once everything is selected, click on “Create Attachment” in the bottom right corner.
Similarly, create the connection from VPC2 following the same steps.
![](http://www.atmarksol.jp/wp-content/uploads/2023/06/画像7-6-417x360.png)
Please make sure that the “State” becomes “Available“.
![](http://www.atmarksol.jp/wp-content/uploads/2023/06/画像8-6.png)
(4) Creating an Association
From the VPC Dashboard, click on “Transit Gateway Route Tables“, and select the route table associated with the Transit Gateway created in step (2). Under “Associations“, click on “Create association“.
![](http://www.atmarksol.jp/wp-content/uploads/2023/06/画像9-5-521x360.png)
Select the attachment for VPC1 and click on “Create association“.
Please create the association for VPC2 connection in the same way.
![](http://www.atmarksol.jp/wp-content/uploads/2023/06/画像10-6.png)
Check that both of the “States” turned to “Associated“.
![](http://www.atmarksol.jp/wp-content/uploads/2023/06/画像11-4-735x360.png)
(5) Creating a propagation
Click on “Transit Gateway Route Tables” in the VPC Dashboard, and select the route table of the Transit Gateway created in step (2). Then, click on “Create propagation” under “Propagations“.
![](http://www.atmarksol.jp/wp-content/uploads/2023/06/画像12-5-585x360.png)
Select the attachment for VPC1 and click on “Create propagation” and create the propagation for the VPC2 connection in the same way.
![](http://www.atmarksol.jp/wp-content/uploads/2023/06/画像13-3-724x360.png)
Make sure the two “States” are now “Enabled“.
![](http://www.atmarksol.jp/wp-content/uploads/2023/06/画像14-2-738x360.png)
(6) Adding a route
Click on “Route Tables” in the VPC Dashboard and select the public route table for VPC1. From the “Routes” tab, click on “Edit routes“.
![](http://www.atmarksol.jp/wp-content/uploads/2023/06/画像15-1-520x360.png)
VPC2のCidrを入力し、手順(1)で作成したのTransit Gatewayを選択してください。選択後、右下の「ルートの保存」をクリックしてください。
![](http://www.atmarksol.jp/wp-content/uploads/2023/06/画像16-1-840x253.png)
Enter the CIDR block for VPC2 and select the Transit Gateway created in Step 1. After selecting, click on “Save routes” at the bottom right.
![](http://www.atmarksol.jp/wp-content/uploads/2023/06/画像17.png)
Enter the CIDR block for VPC1 and select the Transit Gateway created in Step 1. After selecting, click on “Save routes” at the bottom right to complete the creation.
![](http://www.atmarksol.jp/wp-content/uploads/2023/06/画像18-840x201.png)
Conclusion
We have provided a detailed explanation of how to use Transit Gateway to connect VPCs. By leveraging Transit Gateway, you can efficiently connect multiple VPCs and on-premises networks, allowing you to build a flexible and scalable network environment.
We encourage you to make use of Transit Gateway in your own network environment to achieve effective network connectivity.