Skip to main content

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.

Image 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
CategoryProject AProject B
ProjectProject to shareProject to receive the sharing
VPC IP10.0.0.0/16172.16.0.0/16
Virtual Machine IP10.0.1.167172.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.

  1. 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.
  2. Refer to Share transit gateway to share the transit gateway (Tgw-1) created in Project A with Project B.

  3. 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.

  1. 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.

  2. 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.

    info

    If 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 to manual, and if the status of the transit gateway stays at Pending Approve, Project A needs to approve it. For more details on approval, refer to Approve attachment.

  3. Refer to Modify association and Add route to associate the created Attachments with the route table and set up routes.

    DestinationTarget
    Project A's Attachment10.0.0.0/16
    Project B's Attachment172.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.

  1. Project A: Refer to Add route to add a Route setting for the transit gateway in the VPC's route table.

    DestinationTarget typeTarget
    172.16.0.0/16transit gatewayTgw-1 (Transit gateway created in Project A)
  2. Project B: Refer to Add route to add a route setting for the transit gateway in the VPC's route table.

    DestinationTarget typeTarget
    10.0.0.0/16transit gatewayTgw-1 (Transit gateway created in Project A)

Step 5. Verify the results

  1. 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 Results
    ping 172.16.3.124
  2. 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 Results
    ping 10.0.1.167