Connecting to Mongodb on Droplet from app running on AWS instance?

SSH tunneling is great way to connect to MongoDB running on Droplet from local machine and work on local machine but I don’t know how to connect to MongoDB Droplet from AWS or from anywhere app.

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.

Accepted Answer


Connecting over an SSH Tunnel is probably the most secure means of connecting, though you also have the option of opening remote connections to the MongoDB instance.

In /etc/mongod.conf there’s a directive named bind_ip which you can set to the IP of the Droplet (and then restart MongoDB). I would, however, recommend ensuring that you’ve setup a firewall and are only allowing access to a limited number of IP’s if you go that route.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

The same way.