Managed MongoDB® FAQ
How can I connect to a Database Instance in a Private Network using Public Gateways?
If you want to connect locally to a Database Instance that is not accessible via the public internet, you can use SSH Bastion and connect it to the same Private Network the Database Instance is connected to.
-
Open an SSH tunnel with port forwarding:
ssh -L local_port:instance_id.network_id.internal:27017 bastion@gatewayIP -p 61000 -N
-
Connect using
mongosh
:mongosh --host localhost --port local_port --username "username"
Still need help?Create a support ticket