3

I have been trying to access my database that i created on Amazon DocumentDB via MongoDB Compass using Ec2 Instance but following is the error I keep on getting. There are no issues with the security groups, since I have made sure to give appropriate in bound request rights.

I am able to connect to the DocumentDB cluster via mongo shell after I SSH into the ec2-instance, but I cannot connect it via MongoDB Compass because it throws me the same error that has been attached in the image below

Please help!

Please see error in the image attached here!

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
  • Hello Naveel, what version of MongoDB Compass are you using? The error EADDRINUSE means you have an existing SSH tunnel on your client machine. Have you setup a SSH tunnel via the terminal? – meet-bhagdev Jun 23 '20 at 16:53
  • Hi john. I am using 1.21.2 on mac, and i have not setup an ssh tunnel via terminal since if i do that it hangs me on my terminal after executing the command for ever. – Nabeel Zafar Jun 24 '20 at 17:58
  • Nabeel - the hang means the tunnel was successfully setup. If you are having issues with Compass, I would also recommend you take a look at another popular GUI management tool Robo 3T: https://aws.amazon.com/blogs/database/part-3-getting-started-with-amazon-documentdb-using-robo-3t/ – meet-bhagdev Jun 25 '20 at 00:50

1 Answers1

0

Just use your pem file and set localhost port example here port 8000. Once run this below command then just open mongo compass and host: localhost:8000 then it will connect.

ssh -i my-aws-key.pem -N -f -L 8000:localhost:27017 ec2-user@serverIp

enter image description here

Siva
  • 81
  • 1
  • 1
  • 7