I can't set bindIp

Welcome to the MongoDB Community, @DongHyun_Lee!

That’s actually an incorrect assumption. The bind_ip configuration value only determines which local IP address(es) your MongoDB server is listening to. It does not control access from remote IPs – that is the job of a firewall (like your AWS Inbound rules).

The only valid values for bindIp are local network interfaces for the MongoDB process. For example, on Linux any local IPs would appear in the output of ifconfig -a | grep "inet".

If you want to connect from your Compass on your local computer to a remote MongoDB deployment on AWS, you need to set up a secure connection. Typically this is done via VPN or SSH port forwarding, so your database instance is not directly exposed to the internet. In this case your mongod instance would only need to listen to localhost (for ssh) and the private IP (for VPN or ssh via a jump host on the same private network).

For more information on available security measures, please review the MongoDB Security Checklist.

If you review your MongoDB logs, I expect you’ll find a message like:

Failed to set up listener: SocketException: Can’t assign requested address

This message indicates you are trying to bind to an address that is not a valid local network interface, and will be the reason your MongoDB process is unable to start.

Regards,
Stennie

2 Likes