Configure MongoDB Atlas using VPC peering

This page describes how to configure a MongoDB Atlas source database to work with Datastream using Virtual Private Cloud peering. Note that the described procedure isn't a high availability solution. If the MongoDB node fails the connection profile test, you need to manually run the startup script referenced further in this page on the network address translation (NAT) virtual machine (VM).

Because Virtual Private Cloud peering is non-transitive, you must configure a NAT gateway using a Compute Engine VM to route traffic from Datastream to MongoDB Atlas.

Configure a MongoDB database user

To use Datastream with a MongoDB Atlas instance, you first need to create a database user and grant them access privileges:

  1. In the MongoDB Atlas dashboard, under Security, click Database access.
  2. Click New database user and select the password authentication method for your user.
  3. Enter the username and password for your Datastream user.
  4. Under Database user privileges, select Grant specific user privileges.
  5. Under Specific privileges, add the following role:
    • readAnyDatabase
  6. Click Add user.

Set up your Virtual Private Cloud network

Identify the Virtual Private Cloud network in your Google Cloud project to peer with both Datastream and MongoDB Atlas. This page assumes that you use the default VPC and its subnet, for example the default subnet in the us-central1 region.

  1. Ensure that the network that you identified doesn't have overlapping IP address ranges with your Datastream or MongoDB Atlas networks.
  2. Create a private connectivity configuration to peer Datastream with your Virtual Private Cloud network:
    1. Make sure that you select VPC peering from the Private connectivity method drop-down.
    2. Select your default VPC network.
    3. Provide an unused IP address range, for example