For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
Docs Menu

Add a GCP Pub/Sub Private Service Connect Connection

Atlas Stream Processing supports creating Private Service Connect connections to Google Cloud Pub/Sub.

IMPORTANT: You must have an Atlas cluster hosted on Google Cloud to create a Google Cloud Private Service Connect endpoint through Atlas. Your endpoint must in the same region as this cluster.

Select an option to display the procedure to add the connection using your preferred interface:

To add a Google Cloud Pub/Sub connection to your stream processing workspace through the Atlas Administration API, perform these steps:

1

Follow the procedure described in Set Up and Manage GCP Service Account Access.

Note the Service Account ID for use later in this procedure.

Grant the following roles at both the project and topic levels:

For more information, see the Pub/Sub documentation.

2
  1. If it's not already displayed, select your desired organization from the Organizations menu in the navigation bar.

  2. Click All Projects in the sidebar under the Identity & Access section, and select your desired project.

  3. Click Project Identity & Access in the sidebar under the Security section.

The Users page displays.

3

Create a service account.

Grant this service account the following roles within your Atlas Stream Processing project:

4

The Atlas Administration API provides an endpoint to Create One Private Link.

For a Google Cloud Pub/Sub Private Service Connect connection, set the following key-value pairs:

Key
Value

vendor

"PUBSUB"

provider

"GCP"

region

The Google Cloud region in which you create the endpoint.

Use Return All Private Link Connections to check the state of your endpoint. When it reaches a DONE state, note the value of the _id field.

5

The Atlas Administration API provides an endpoint to Create One Stream Connection.

For a Google Cloud Pub/Sub Private Service Connect connection, set the following key-value pairs:

Key
Value

name

Name you want to give to the connection.

type

"GCPPubSub"

gcp.serviceAccountId

Service Account ID that you noted earlier in this procedure.

networking.access.type

"PRIVATE_LINK"

networking.access.connectionId

Value of _id in the response when you create the Private Service Connect connection.

To add a Google Cloud Pub/Sub connection to your stream processing workspace through the Atlas CLI, perform these steps:

1

Follow the procedure described in Set Up and Manage GCP Service Account Access.

Note the Service Account ID for use later in this procedure.

Grant the following roles at both the project and topic levels:

For more information, see the Pub/Sub documentation.

2
  1. If it's not already displayed, select your desired organization from the Organizations menu in the navigation bar.

  2. Click All Projects in the sidebar under the Identity & Access section, and select your desired project.

  3. Click Project Identity & Access in the sidebar under the Security section.

The Users page displays.

3

Create a service account.

Grant this service account the following roles within your Atlas Stream Processing project:

4

To a Private Link endpoint for a stream processor connection using the Atlas CLI, run the following command:

atlas streams privateLinks create [options]

To learn more about the command syntax and parameters, see the Atlas CLI documentation for atlas streams privateLinks create.

In your configuration file, set the following key-value pairs:

Key
Value

vendor

"PUBSUB"

provider

"GCP"

region

Google Cloud region in which you create the endpoint.

Use atlas streams privateLinks list command to check the state of your endpoint. When it reaches a DONE state, note the value of the _id field.

5

To create one connection for the stream processing workspace you specify using the Atlas CLI, run the following command:

atlas streams connections create [connectionName] [options]

To learn more about the command syntax and parameters, see the Atlas CLI documentation for atlas streams connections create.

In your configuration file, set the following key-value pairs:

Key
Value

name

Name for the connection.

type

"GCPPubSub"

gcp.serviceAccountId

Service Account ID that you noted earlier in this procedure.

networking.access.type

"PRIVATE_LINK"

networking.access.connectionId

Value of _id in the response when you create the Private Link connection.

To add a Google Cloud Pub/Sub connection to your stream processing workspace through the Atlas UI, follow these steps:

1

Follow the procedure described in Set Up and Manage GCP Service Account Access.

Note the Service Account ID for use later in this procedure.

Grant the following roles at both the project and topic levels:

For more information, see the Pub/Sub documentation.

2
  1. If it's not already displayed, select the organization that contains your project from the Organizations menu in the navigation bar.

  2. If it's not already displayed, select your project from the Projects menu in the navigation bar.

  3. In the sidebar, click Database & Network Access under the Security heading.

The Database & Network Access page displays.

3
  1. In the sidebar, click Private Endpoint.

  2. Click the Atlas Stream Processing tab.

    If you have not created an Atlas Stream Processing private endpoint previously, click Create endpoint. If you have, click Add ASP Endpoint.

4
  1. Set Cloud Provider to GCP.

  2. Set Vendor to Pub/Sub.

  3. Click Next, enter service details

5

Your endpoint must be both:

  • In the same region as your Atlas Google Cloud cluster

  • In the same region in which you intend to host the stream processors that use it.

  1. Click Next, generate endpoint ID
6
  1. If it's not already displayed, select the organization that contains your project from the Organizations menu in the navigation bar.

  2. If it's not already displayed, select your project from the Projects menu in the navigation bar.

  3. In the sidebar, click Stream Processing under the Streaming Data heading.

The Stream Processing page displays.

7
  1. Locate the overview panel of the stream processing workspace you want to modify and click Manage.

  2. In the sidebar, click Connection Registry.

8
  1. Click + Add connection.

  2. Select a GCP Pub/Sub connection.

  3. Provide a Connection Name. Each connection name must be unique within a stream processing workspace. This is the name used to reference the connection in Atlas Stream Processing aggregations.

  4. Click the Private Service Connect button.

  5. Toggle Enable Private Service Connect Networking on.

  6. From the dropdown menu, select the private endpoint you created earlier.

  7. From the GCP Service Account dropdown, select the ID of the unified access role you authorized in a prior step.

  8. Click Add connection.

Google Cloud Pub/Sub sink connections support only the $emit stage, not the $merge stage. For more information, see $emit.

Rate this page