This page describes how to establish a secure connection between MongoDB Atlas source database and Datastream by allowlisting specific IP addresses. The IP allowlist connectivity method ensures that your database only accepts traffic from an authorized Datastream instance.
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:
- In the MongoDB Atlas dashboard, under Security, click Database access.
- Click New database user and select the password authentication method for your user.
- Enter the username and password for your Datastream user.
- Under Database user privileges, select Grant specific user privileges.
- Under Specific privileges, add the following role:
readAnyDatabase
- Click Add user.
Retrieve Datastream public IP addresses
When you create a connection profile for your source database, you need to retrieve the public IP addresses for Datastream to authorize them in MongoDB Atlas.
Go to the Connection profiles page in the Google Cloud Console.
Click Create profile and select MongoDB.
Enter the connection details, including the connection profile name, hostname or IP address, port, and database user credentials.
In the Define connection settings section, locate the list of Datastream public IP addresses.
Copy these IP addresses.
Configure IP allowlists in MongoDB Atlas
Allow the Datastream public IP addresses in your MongoDB Atlas security settings:
- Sign in to your MongoDB Atlas account.
- In the navigation menu, click Security, and then click Network access.
- Click Add IP address.
- Enter the first IP address that you copied from Datastream.
- Repeat this process for each IP address that you want to allowlist.
- Click Confirm and wait for the status to change to Active.
Test and create the connection profile
After you activate the IP allowlists in MongoDB Atlas, you can verify the connection.
- Go back to the Connection profiles setup page in the Google Cloud console.
- Click Run test to test the connectivity to your database.
- Verify that the test succeeds, and then click Create to save the profile.
If the test fails, check that all Datastream IP addresses are active in the Atlas instance Network access list and that the database user has the correct privileges assigned.