Ubuntu – Connect MongoDB Compas to GCP Ubuntu VM

google-cloud-platformmongodbUbuntu

I am a little lost on how should I host MongoDB on Ubuntu VM. I barely worked with Ubuntu before so I struggle to understand a lot of aspects.

I followed guide: https://docs.mongodb.com/tutorials/install-mongodb-on-ubuntu/

And everything seemed to work in GCP VM SSH console. I was able to login to DB with admin login and password. But I don't understand why I cannot connect to it from external resources and how to debug the issue.

I am trying to access DB with VM external IP, provided by GCP compute engine, I used existing authentication information but it doesn't work, all I get is this error after around a minute of waiting:

Could not connect to MongoDB on the provided host and port

Is there any guide or advice to help me understand what exactly is wrong? I am lost and don't know what to check to even find the issue.

Best Answer

Okay, I finally managed it to work.

Here are useful articles that contain helpful information. Literally, 1 line from each source helps to build the whole picture.

There were more articles but I don't remember other. The last issue was that I needed to open the port(27017) on GCP for TCP connection and to add authorization option to security part in the configuration file.

Related Topic