Share transit gateway
This document describes how to set up and verify communication between VPCs in two different projects using the sharing feature of the transit gateway.
Share transit gateway
Step 1. Preparation
The sharing settings of the transit gateway described in this document assume that VPCs and Virtual Machines have already been created in two different projects. To carry out this scenario, please create VPCs and Virtual Machines by referring to the following information and each service document.
Example of VPC / Virtual Machine Creation
Category | Project A | Project B |
---|---|---|
Project | Project to share | Project to receive the sharing |
VPC IP | 10.0.0.0/16 | 172.16.0.0/16 |
Virtual Machine IP | 10.0.1.167 | 172.16.3.124 |
Step 2. Create and share the transit gateway
The following is to create a transit gateway in Project A and share it with Project B.
-
Refer to Create transit gateway to create a transit gateway in Project A that will share the VPC.
- The transit gateway created in Project A is referred to as
Tgw-1
.
- The transit gateway created in Project A is referred to as
-
Refer to Share transit gateway to share the transit gateway (
Tgw-1
) created in Project A with Project B. -
In Project B, check if the transit gateway (
Tgw-1
) has been successfully shared in the transit gateway list.
Step 3. Create attachments and configure routes
To connect resources to the transit gateway and set up traffic, create Attachments and set Routes in each project.
-
Project A: Refer to Create attachment to create an Attachment for
Tgw-1
. Specify the Resource as the VPC (10.0.0.0/16) and Subnet (Subnet where Virtual Machine is created) to connect. -
Project B: Refer to Create attachment to create an Attachment for
Tgw-1
. Specify the Resource as the VPC (172.16.0.0/16) and Subnet (Subnet where Virtual Machine is created) to connect.infoIf the Sharing acceptance method was set to
automatic
when creating the transit gateway in Project A, the attachment created in Project B will be created immediately. However, if it was set tomanual
, and if the status of the transit gateway stays atPending Approve
, Project A needs to approve it. For more details on approval, refer to Approve attachment. -
Refer to Modify association and Add route to associate the created Attachments with the route table and set up routes.
Destination Target Project A's Attachment 10.0.0.0/16 Project B's Attachment 172.16.0.0/16
Step 4. Set the route table of VPC
To route traffic received from the transit gateway, set the route table in each project's VPC.
-
Project A: Refer to Add route to add a Route setting for the transit gateway in the VPC's route table.
Destination Target type Target 172.16.0.0/16 transit gateway Tgw-1
(Transit gateway created in Project A) -
Project B: Refer to Add route to add a route setting for the transit gateway in the VPC's route table.
Destination Target type Target 10.0.0.0/16 transit gateway Tgw-1
(Transit gateway created in Project A)
Step 5. Verify the results
-
Perform a Ping test from Virtual Machine (10.0.1.167) in Project A to Virtual Machine (172.16.3.124) in Project B to verify that the transit gateway has been shared correctly.
Verifying Resultsping 172.16.3.124
-
Conduct a Ping test from Virtual Machine (172.16.3.124) in Project B to Virtual Machine (10.0.1.167) in Project A to ensure connectivity in both directions.
Verifying Resultsping 10.0.1.167