MongoDB Compass connectivity issue with Ec2 Instance to access amazon documentDB cluster

Viewed 1086

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!

1 Answers

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

Related