Can't connect to MongoDB in Google Compute Engine from other machine

Hi all,

I am trying to connect to the MongoDB in GCE from my local machine.

First, I open the port 27017 for my GCE.

Then I follow the instruction to edit “/opt/bitnami/mongodb/mongodb.conf”

bind_ip =

And restart the MongoDB server by

sudo /opt/bitnami/ restart mongodb

However, I still can’t connect to the mongodb remotely, connection timeout …
Here is the connection command I run :

mongo admin --username root -p password --host HOST_IP --port 27017

I test the 27017 port by using open port check tool, it still shows the 27017 port is closed? Can anyone help me solve this problem?

Many thanks!

Hi @yusong

Could you please double check that you followed all the steps described in the guide below in order to open the port?

It should work with the steps that you described.


@fortiz My bad,

In the firewall rule, I put instead of Now it works, thank you!

Hi @yusong

I’m glad to hear that! :smile: Please, feel free to post here if you have any other question.


I am not using bitnami but I did all security steps and nothing works. Any advice?

network interfaces

port: 27017
bindIp: # Enter,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.

Hi @ezequias ,

Please note we only provide support to Bitnami related installation and configuration problems. In your case, there is such a big list of possible combinations of custom MongoDB configurations, Windows environments and networking that we can not support all of them. That’s why we only support Bitnami way of installation and config so we can do our best with our support offering.

We recommend you to ask in a more generic forum like Stack Overflow, Reddit or even the Google Cloud Platform support system.

Sorry for the inconvenience it may cause you.


Thank you for you advice and for being to polite.

Best regards

HI @ezequias,

Hope you can fix your issue! :slight_smile:


So do I. Nothing until now.

I can connect to in the host but not using a real external ip.

Any advice would be great for me.

Ezequias Rocha

Now it’s OK @gongomgra

Hi @ezequias,

I’m glad you could fix your issue! :slight_smile: We will close this ticket as solved.

Best regards,