Propose a VPC spoke in a different project

When you create a spoke, you must associate it with a hub. If your spoke is in a different project from the hub, the hub administrator must approve your proposed spoke before it can become active. To create a VPC spoke that you want to connect to a hub in a different project, follow these steps.

For information about how to work with spokes including creating, listing, updating, and deleting spokes, see Work with spokes.

Before you begin

Before you get started, review the following sections.

Create or select a project

To make it easier to configure Network Connectivity Center, start by identifying a valid project.

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Google Cloud project.

  4. Install the Google Cloud CLI.
  5. To initialize the gcloud CLI, run the following command:

    gcloud init
  6. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  7. Make sure that billing is enabled for your Google Cloud project.

  8. Install the Google Cloud CLI.
  9. To initialize the gcloud CLI, run the following command:

    gcloud init
  10. If you are using the Google Cloud CLI, set your project ID by using the gcloud config set command.

    gcloud config set project PROJECT_ID

    Replace PROJECT_ID with your unique project ID.

    The gcloud CLI instructions on this page assume that you have set your project ID.

  11. To confirm that you set the project ID correctly, use the gcloud config list command.

    gcloud config list --format='text(core.project)'

Enable the Network Connectivity API

Before you can perform any tasks using Network Connectivity Center, you must enable the Network Connectivity API.

Console

To enable the Network Connectivity API:

  1. In the Google Cloud console, go to the Network Connectivity Center page.

    Go to Network Connectivity Center

  2. Click Enable.

Alternatively, you can enable the API by using the Google Cloud console API Library, as described in Enabling APIs.

Propose a spoke

To create a VPC spoke in the same project as the hub or in a different project, follow these steps.

If you want to assign exclude export ranges or include export ranges, use the appropriate options during spoke creation.

Console

  1. In the Google Cloud console, go to the Network Connectivity Center page.

    Go to Network Connectivity Center

  2. In the project menu, select a project in which you want to create the spoke.

  3. Click the Spokes tab.

  4. Click Add spokes.

  5. In the Select hub section, to attach the new spoke to a hub in another project, select the hub location as In another project.

  6. Enter the Project ID and the Hub name to which you want to attach your new spoke.

  7. Enter a Spoke name and optionally, a Description.

  8. If the hub that you are connecting to is configured for star topology, select or enter the Spoke group name for your spoke. For information about star topology, see Star topology. For information about spoke groups, see Spoke groups.

  9. For Spoke type, the following options are available:

    • For a hub in a different project, the default Spoke type is VPC spoke.
    • For a hub in the same project, allowed spoke types are determined by pre-existing spoke types.
    • If there are no spokes, you can select any spoke type, although the preselected option is Cloud VPN tunnel.
  10. To add a VPC network to the spoke, select the VPC network from the list.

  11. Optionally, you can add a VPC spoke filter to customize how routes are advertised by entering an IP address range to exclude or include export from the spoke to hub. You cannot change this filter after the spoke is created.

  12. Click Done.

  13. If you want to add more spokes, click Add spoke and begin the process again, starting with entering a Spoke name.

  14. When you have finished adding spokes, click Create. The Network Connectivity Center page updates to show details about the spokes that you created.

    The spoke status remains Inactive until the hub administrator reviews and accepts your proposed spoke.

gcloud

To create a VPC spoke, use the gcloud network-connectivity spokes linked-vpc-network create command.

gcloud network-connectivity spokes linked-vpc-network create SPOKE_NAME \
    --hub=HUB_URI \
    --global \
    --vpc-network=VPC_NETWORK \
    --exclude-export-ranges=[EXCLUDE_CIDR_RANGE] \
    --include-export-ranges=[INCLUDE_CIDR_RANGE] \
    --group=GROUP_NAME

Replace the following:

  • SPOKE_NAME: a name for the spoke that you are creating.
  • HUB_URI: the URI of a hub in a different project that you want to create the spoke in.
  • VPC_NETWORK: the VPC network that this spoke provides connectivity to. The VPC network must be in the same project as the spoke.
  • [EXCLUDE_CIDR_RANGE]: a comma-separated list of IP address ranges to be excluded from exporting to the hub (up to 16 CIDR ranges), such as 10.1.0.0/16, 192.168.0.0/24, 172.16.1.1/32. The specified ranges must be longer than or equal to the individually configured subnets within the VPC.
  • [INCLUDE_CIDR_RANGE]: a comma-separated list of IP address ranges to be included in exporting to the hub (up to 16 CIDR ranges), such as 10.1.0.0/16, 192.168.0.0/24, 172.16.1.1/32.
  • GROUP_NAME: the group this spoke belongs to. The supported values are default for a mesh topology hub or center or edge for a star topology hub. This field is required for spoke groups that use star topology. For detailed information about spoke groups, see Spoke groups.

API

To create a VPC spoke, use the networkconnectivity.spokes.create method.

  POST https://networkconnectivity.googleapis.com/v1/projects/PROJECT_ID/locations/global/spokes
  {
    "name":"NAME",
    "hub":"HUB_URI",
    "linkedVpcNetwork": {
       "uri": VPC_URI,
       "include_export_ranges": "[INCLUDE_CIDR_RANGE]",
       "exclude_export_ranges": "[EXCLUDE_CIDR_RANGE]",
       "group": "GROUP_NAME"
    },
  }

Replace the following values:

  • PROJECT_ID: the project ID of the project that contains the new spoke.
  • HUB_URI: the full hub URI including the project, since the hub is in a different project from the spoke—for example, projects/hub-project-ID/locations/global/hubs/hub-name.
  • VPC_URI: The VPC network that this spoke points to, such as vpc_uri.
  • [INCLUDE_CIDR_RANGE]: a comma-separated list of IP address ranges to be included in exporting to the hub (up to 16 CIDR ranges), such as 10.1.0.0/16, 192.168.0.0/24, 172.16.1.1/32. The specified ranges must be longer than or equal to the individually configured subnets within the VPC.
  • [EXCLUDE_CIDR_RANGE]: a comma-separated list of IP address ranges to be excluded from exporting to the hub (up to 16 CIDR ranges), such as 10.1.0.0/16, 192.168.0.0/24, 172.16.1.1/32.
  • GROUP_NAME: the group that this spoke belongs to—for example, center or edge. This field is required for spoke groups that use star topology. For detailed information about spoke groups, see Spoke groups.

What's next