Explore Courses Blog Tutorials Interview Questions
0 votes
in AWS by (19.1k points)

I could not understand what bind_ip in MongoDB is. I could make a remote connection from desktop to the EC2 machine by having bind_ip =, but could not make it work with bind_ip =

Please explain to me what bind_ip is and why it works for and not for

For reference from mongodb docs:


Default: All interfaces.

Set this option to configure the mongod or mongos process to bind to and listen for connections from applications on this address. You may attach mongod or mongos instances to any interface; however, if you attach the process to a publicly accessible interface, implement proper authentication or firewall restrictions to protect the integrity of your database.

You may concatenate a list of comma separated values to bind mongod to multiple IP addresses.

1 Answer

0 votes
by (44.4k points)

Before binding your server to, please be clear about the security implications of these changes: Your server is publicly exposed to any or all IPs on the entire web. Be sure to enable authentication on your server!

You can't access your machine once you bind it to on EC2. That's not a bug, it's reasoned by the network interface bindings. can only bind to the loopback interface (so you'll only be able to access it locally), while will bind it to any or all network interfaces that are accessible.

That's why you'll be able to access your MongoDB on EC2 once you bind it to it's available through the web now) and not via

For local servers (like a WAMP or a local MongoDB server) that won't look different to you, but for that case you should also think that binding to for local servers might build them available overall network interfaces (so it'd be public for somebody who knows your IP, if there's no firewall!)

Related questions

0 votes
1 answer

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
2 answers
asked Sep 13, 2019 in SQL by Sammy (47.6k points)

Browse Categories