A private connectivity configuration lets you connect Datastream to
data sources over an internal Google Cloud network, VPN, or
Cloud Interconnect. You can connect through a
Private Service Connect interface attached to a network attachment
subnetwork in your Virtual Private Cloud (VPC) network.

Alternatively, you can use VPC peering to route traffic between
two VPC networks over an allocated internal IP range. Because
Datastream doesn't support DNS resolution in private
connections, you must specify private IPv4 addresses for your sources.

Note that Datastream automatically deletes private connectivity
configurations that haven't been used for a period of six consecutive months.
To retain your private connectivity configurations, make sure they are used in
at least one active connection profile.

## Before you begin

Before you create your private connectivity configuration, review the
prerequisites:

- For VPC peering, see [VPC peering prerequisites](https://docs.cloud.google.com/datastream/docs/vpc-peering#vpc-prereqs).
- For Shared VPC, see [Shared VPC prerequisites](https://docs.cloud.google.com/datastream/docs/vpc-peering#shared-vpc).
- For Private Service Connect interfaces, see [Private Service Connect prerequisites](https://docs.cloud.google.com/datastream/docs/psc-interfaces#psci-prereqs).

## Create the configuration

To create a private connectivity configuration, perform the following steps:

1. Go to the **Private connectivity configurations** page in the Google Cloud console.

   [Go to the Private connectivity configurations page](https://console.cloud.google.com/datastream/private-connections)
2. Click **Create configuration**.

3. Use the following table to populate the fields of the
   **Configure private connectivity** section of the
   **Create private connectivity configuration** page:

   | Field | Description |
   |---|---|
   | Configuration name | Enter the display name of the private connectivity configuration. |
   | Configuration ID | Datastream populates this field automatically based on the configuration name that you enter. You can keep the ID that's auto-generated or change it. |
   | Region | Select the region where the private connectivity configuration is stored. > [!NOTE] > To use a private connection, any streams and connection profiles that use this configuration must be in the same region. |

4. In the **Set up connection** section, select an option from the
   **Private connectivity method** drop-down:

   - **PSC interfaces** : select this option to use Private Service Connect interface as your private connectivity method:

     | Field | Description |
     |---|---|
     | Project ID | Select the identifier of the project where the network attachment that you want to use is. By default, this is your current project. To change the value, click **Change** and select a different project. > [!NOTE] > To view the list of network attachments in the selected project, you need the `compute.networkAttachments.get` permission. |
     | Network attachment | Select the network attachment that you created for your VPC. > [!NOTE] > Ensure that the subnetwork associated with the network attachment doesn't overlap with the internal IP ranges reserved by Datastream (`100.64.0.0/16` and `100.65.0.0/24`). |
     | Update allowlist | Click this button to allow connections from the Datastream IP addresses. You need to have the `compute.networkAdmin` role assigned to connect to the network attachment. |

   - **VPC peering** : select this option to use VPC peering as your private connectivity method:

     | Field | Description |
     |---|---|
     | Authorized VPC network | Select the VPC network that you created. |
     | Allocate an IP range | Enter an available IP range on the VPC network. > [!NOTE] > Ensure that the IP range doesn't overlap with the internal IP ranges reserved by Datastream (`100.64.0.0/16` and `100.65.0.0/24`). |

5. Click **CREATE**.

   It takes a few minutes for your private connectivity configuration to be created. Background resources need to be created so that the configuration can be created.

After creating a private connectivity configuration, you can
[view high-level and detailed information](https://docs.cloud.google.com/datastream/docs/view-a-private-connectivity-configuration)
about it.

## What's next

- Learn how to [view your private connectivity configuration](https://docs.cloud.google.com/datastream/docs/create-a-private-connectivity-configuration).
- Find out how to [delete a private connectivity configuration](https://docs.cloud.google.com/datastream/docs/delete-a-private-connectivity-configuration).
- Learn about the [Private Service Connect interfaces](https://docs.cloud.google.com/datastream/docs/psc-interfaces) private connectivity method.
- Learn about the [VPC peering](https://docs.cloud.google.com/datastream/docs/vpc-peering) private connectivity method.