Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

464
Views
Connect to EC2 via MongoDB Compass Community

I have an EC2 instance (Ubuntu 14). I've defined port 27017 in its security group to be accessed from anywhere.

I'm trying to connect from my PC (Windows 10) to the EC2 instance, but getting the following error:

MongoDB not running on the provided host and port

which is not true since I've made sure that MongoDB is running.

These were the settings I specified:

enter image description here

I've also tried to use SSH (which is also defined in the sercurity group and works well through terminal), but got the following error:

Error creating SSH Tunnel: (SSH) Channel open failure: Connection refused

These were the settings I specified:

enter image description here

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Alon,
Checkpoints

  1. See if there is a need to change the bind_ip variable at the /etc/mongodb.conf file.
    By default, it is locked to localhost.
    Try setting the value to 0.0.0.0 or assign the IP that will be able to connect the DB to it.
  2. Port is allowed in security group attached to EC2 (You mentioned its done)
  3. Not using private IP to connect (I guess, you are using the right one as you connected through terminal)
  4. Rare case, OS firewall

I guess point 1 should do the trick. Rest points for future reference

[Update 1]
Doc link for bindIp
https://docs.mongodb.com/manual/reference/configuration-options/#net-options

over 4 years ago · Santiago Trujillo Report

0

I am putting this as an answer although it is meant as a comment to the answer by raevilman above but I do not have the necessary reputation to post comments yet.

If you set the bind_ip variable to 0.0.0.0 as mentioned, MongoDB accepts connections from all IP addresses. This might be a security risk if you do not use access control.

On the other hand, if I am not wrong, the idea of a SSH tunnel is for that, in this case MongoDB, the entering connection comes from localhost so no change in the configuration should be necessary.

That said, I came here because I could not connect either. I got the error 'Error creating SSH Tunnel: Timed out while waiting for forwardOut'.

In my case the solution was to put 'localhost' in the hostname field at the top instead of the host IP.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!