> [!WARNING]
>
> **Preview**
>
>
> This feature is
>
> subject to the "Pre-GA Offerings Terms" in the General Service Terms section of the
> [Service Specific
> Terms](https://docs.cloud.google.com/terms/service-terms#1).
>
> Pre-GA features are available "as is" and might have limited support.
>
> For more information, see the
> [launch stage descriptions](https://cloud.google.com/products/#product-launch-stages).

This page describes how to create a Network Connectivity Center (NCC) hub using the
hybrid inspection topology so that you can add NCC Gateway spokes
and VPC spokes to the hub.

For an introduction to NCC Gateway, see the
[NCC Gateway overview](https://docs.cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/ncc-gateway-overview).

## Before you begin

Before you get started, review the following sections.

### Create or select a project

To make it easier to configure NCC, start by identifying a valid
project.

1. If you are using the Google Cloud CLI, set your project
   ID by using the
   [`gcloud config set` command](https://docs.cloud.google.com/sdk/gcloud/reference/config/set).

   ```
   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.
2. To confirm that you set the project ID correctly, use the
   [`gcloud config list` command](https://docs.cloud.google.com/sdk/gcloud/reference/config/list).

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

### Enable the Network Connectivity API

Before you can perform *any* tasks using NCC Gateway, you must
enable the Network Connectivity API.

### Console

To enable the Network Connectivity API, do the following:

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

   [Go to Network Connectivity Center](https://console.cloud.google.com/hybrid/hubs/list)
2. Click **Enable**.

Alternatively, you can enable the API by
using the
[Google Cloud console API Library](https://console.cloud.google.com/apis/library?project=_),
as described in [Enabling APIs](https://docs.cloud.google.com/apis/docs/getting-started#enabling_apis).

### Get access

To work with NCC and NCC Gateway, you need the
permissions described in
[Roles and permissions](https://docs.cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/access-control).

### Identify resources

When you reference resources by using the
gcloud CLI or the API, use the conventions described in the
following table.

| Convention | Supported for | Notes | Example |
|---|---|---|---|
| Full URI | All resources | Use one of these methods to reference Router appliance instances. | ``` "https://www.googleapis.com/compute/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME" ``` |
| [Relative resource name](https://google.aip.dev/122) | All resources | Use one of these methods to reference Router appliance instances. | ``` "projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME" ``` |
| Name | Regional and global resources | Use this method for hubs, spokes, VPN tunnels, and VLAN attachments. | ``` "HUB_NAME" ``` |

## Create an NCC hub

To create an NCC hub with the preset
[hybrid inspection topology](https://docs.cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/connectivity-topologies#hybrid-inspection-topology),
follow these steps:

### gcloud

Use the [`gcloud network-connectivity hubs create` command](https://docs.cloud.google.com/sdk/gcloud/reference/network-connectivity/hubs/create)
and specify the hybrid inspection preset topology.

```
gcloud beta network-connectivity hubs create HUB_NAME \
    --preset-topology=hybrid-inspection
```

Replace `HUB_NAME` with a name for the new hub.

### API

Use the
[`projects.locations.global.hubs.create` method](https://docs.cloud.google.com/network-connectivity/docs/reference/networkconnectivity/rest/v1beta/projects.locations.global.hubs/create).

```
POST https://networkconnectivity.googleapis.com/v1beta/projects/PROJECT_ID/locations/global/hubs
{
  "name":"HUB_NAME",
  "description":"DESCRIPTION",
  "labels": {
    "KEY": "VALUE"
  },
  "presetTopology": "HYBRID_INSPECTION"
}
```

Replace the following:

- `PROJECT_ID`: the project ID of the project that contains the new hub
- `HUB_NAME`: the name of the new hub
- `DESCRIPTION`: optional text that describes the hub
- `KEY`: the key in the key-value pair for the optional label text
- `VALUE`: the value in the key-value pair for the optional label text

## Connect VPC networks to the hub

The process for connecting VPC networks to a hub differs
depending on whether the network and hub are in the same project.

### Connect VPC networks and hub from different projects

To connect VPC networks from different projects,
use the following steps:

- A VPC spoke administrator [proposes a VPC
  spoke in a different
  project](https://docs.cloud.google.com/network-connectivity/docs/network-connectivity-center/how-to/vpc-propose-a-spoke)
- A hub administrator [reviews proposed VPC
  spokes](https://docs.cloud.google.com/network-connectivity/docs/network-connectivity-center/how-to/vpc-review-proposed-spokes)

### Connect VPC networks and hub in the same project

If the VPC networks and hub are in the same project, you
can follow these steps in this section.

### gcloud

Use the [`gcloud network-connectivity spokes linked-vpc-network create` command](https://docs.cloud.google.com/sdk/gcloud/reference/network-connectivity/spokes/linked-vpc-network/create):

```
gcloud network-connectivity spokes linked-vpc-network create SPOKE_NAME \
    --hub=HUB_NAME \
    --description=DESCRIPTION \
    --vpc-network=VPC_NETWORK_URI \
    --global \
    --group=GROUP_NAME
```

Replace the following:

- `SPOKE_NAME`: the name of the spoke that you are creating, such as `vpc-spoke1`
- `HUB_NAME`: the hub for the spoke
- `DESCRIPTION`: an optional description of the spoke
- `VPC_NETWORK_URI`: the VPC network that this spoke points to
- `GROUP_NAME`: the group that this spoke belongs to

Because the hub uses the [hybrid inspection
topology](https://docs.cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/connectivity-topologies#hybrid-inspection-topology),
valid group names for VPC spokes are `prod`, `non-prod`, and `services`.

For additional options available when adding a VPC spoke, including
details about export filters, see
[Create a VPC spoke](https://docs.cloud.google.com/network-connectivity/docs/network-connectivity-center/how-to/working-with-hubs-spokes#create-vpc-spoke).

### API

Use the [`projects.locations.spokes.create` method](https://docs.cloud.google.com/network-connectivity/docs/reference/networkconnectivity/rest/v1/projects.locations.spokes/create):

```
POST https://networkconnectivity.googleapis.com/v1/projects/PROJECT_ID/locations/global/spokes/SPOKE_NAME

{
 "hub":"HUB_NAME",
 "description": "DESCRIPTION",
 "linkedVpcNetwork": {
    "uri": "VPC_NETWORK_URI",
    "include_export_ranges": "[INCLUDE_RANGES]",
    "exclude_export_ranges": "[EXCLUDE_IPV4_RANGES]",
    "group": "GROUP_NAME"
 },
}
```

Replace the following:

- `SPOKE_NAME`: the name of the spoke that you are creating, such as `vpc-spoke1`
- `HUB_NAME`: the hub for the spoke
- `DESCRIPTION`: an optional description of the spoke
- `VPC_NETWORK_URI`: the VPC network that this spoke points to
- `GROUP_NAME`: the group that this spoke belongs to

Because the hub uses the [hybrid inspection
topology](https://docs.cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/connectivity-topologies#hybrid-inspection-topology),
valid group names for VPC spokes are `prod`, `non-prod`, and `services`.

For additional options available when adding a VPC spoke, including
details about export filters, see [Create a VPC
spoke](https://docs.cloud.google.com/network-connectivity/docs/network-connectivity-center/how-to/working-with-hubs-spokes#create-vpc-spoke).