Connecting to MongoDB Atlas from DigitalOcean App platform

Hey everyone,

First of all, I know that DigitalOcean has a managed MongoDB service, but the client I work with wants to host their database using MongoDB Atlas. I setup a Node app using DO App platform and successfully connecting the subdomain.

I then got the IP address of the server using ping I proceeded to add this IP address to MongoDB Atlas in the network access tab, but the app still fails to connect the the database on MongoDB Atlas.

I used the same connection string locally using MongoDB Compass and everything works, which leads me to believe that the IP address I am using for the DO server is incorrect.

Has anyone else been able to hook these two services up? All help appreciated. Thank you in advance.

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
February 20, 2023

Hey @brianklein,

As of the time being the DigitalOcean App Platform does not come with a static IP address.

It looks like someone has had the same idea before and has posted it on our Product Ideas board. The best thing to do would be to head over and add your vote to it, as well as adding any additional information in the comments for exactly what you’d like to see implemented!

Indeed as you mentioned, for the moment, you could use a Managed MongoDB cluster which you could secure/lock down using the Trusted Sources functionality.

Hope that helps!

- Bobby.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel