Cloud Run Connects MongoDB Atlas with Network Peering

I want to peer with MongoDB atlas in Cloud Run.

Special Hot Alien
2 min readJul 19, 2022
Photo by Alina Grubnyak on Unsplash

Network peering is possible so that MongoDB can access it with a private IP. But the setup isn’t easy.

The configuration method is described in detail in the article below. It is important to note that the configuration must be done in the correct order.

Another thing to note is that it takes time to update the status in MongoDB atlas > Network Access > Peering, so be patient. When setting for the first time, it is in Pendingstate, and if the connection is set up correctly, it is changed to Availablestate. At this time, if you look at GCP VPC network peering, you can confirm that it is in Active state. If the status is other than that, it is a case of network peering failure and must be deleted and reconfigured.

When setting up a private IP network peering, the part that I did not pay close attention to was the connection string. As a result of the actual check, the hostname for public and the hostname for private was different. It took me several hours to verify this. Please be sure to familiarize yourself with the following.

--

--