I successfully set up AWS DocumentDB with a bastion server, and I can connect to it using MongoDB Compass. However, when attempting to access the resource programmatically, I encounter a timeout error

0

I employed this code from "https://docs.aws.amazon.com/documentdb/latest/developerguide/connect_programmatically.html#connect_programmatically-tls_disabled". It functioned correctly on the bastion server, but it isn't working on my local server and also I get this error "raise ServerSelectionTimeoutError( pymongo.errors.ServerSelectionTimeoutError:"

  • Hi,

    From your local, did you connect to the bastion first with an SSH tunnel as mentioned here?

    https://docs.aws.amazon.com/documentdb/latest/developerguide/connect-from-outside-a-vpc.html

  • Hi, Kyle_B I've successfully established a connection to the bastion server from my local machine, and it's functioning well. However, I encountered an issue when attempting to access the DocumentDB via programming from my local machine. While the AWS documentation outlines how to access DocumentDB programmatically, the same program that works on the Bastion server doesn't function on my local machine outside the VPC. My question is, how can I connect to DocumentDB programmatically from my local machine?

  • Karthik,

    Was the SSH tunnel created from the bastion?

  • Yes, if I follow this documentation, the program works correctly when executed on the Bastion server since both the AWS DocumentDB and the Bastion server exist in the same VPC. However, my concern is whether I am required to run the program exclusively on the Bastion server. Unlike with a MySQL cluster in RDS, where I can programmatically access it without needing jump server credentials, I wish to run the program solely on my local machine. The current documentation only provides the URI, and while adding SSH tunneling credentials establishes a connection, it does not reach the DocumentDB.

KARTHIK
asked 5 months ago105 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions