@Kushagra_Kesav thanks for your information (the link) and specifying that i should use pymongo[aws], indeed i was still using pymongo[srv].
However this still times out… But i did read in the link you provided this :
And i notice 2 things compared to my URI string :
- I have not
authMechanism=MONGODB-AWS - I should not be using the ENV VARS in the URI
I did the following tests and all failed (i have attached some logs, not all of them) :
- The uri looks like :
uri = "mongodb://example.com/mydatabase?authMechanism=MONGODB-AWS&retryWrites=true"
[INFO] 2023-04-25T18:14:32.183Z d20d74ef-a284-4102-b4bf-05f6a84bc7e5 Uri after parse : mongodb://myproject.80ebt.mongodb.net/?authMechanism=MONGODB-AWS&retryWrites=true and client : Database(MongoClient(host=['myproject.80ebt.mongodb.net:27017'], document_class=dict, tz_aware=False, connect=True, authmechanism='MONGODB-AWS', retrywrites=True), 'mydatabase')
2023-04-25T18:14:37.190Z d20d74ef-a284-4102-b4bf-05f6a84bc7e5 Task timed out after 5.01 seconds
- The uri looks like :
uri = "mongodb://example.com/mydatabase?authMechanism=MONGODB-AWS"(like the documentation withoutretryWrites=true) - The uri looks like :
uri = "mongodb://example.com/?authMechanism=MONGODB-AWS"(like the documentation, without specifing the database name) :
[INFO] 2023-04-25T18:15:17.319Z 783af7f1-6238-4b05-96d5-2e2798888d56 Uri after parse : mongodb://myproject.80ebt.mongodb.net/?authMechanism=MONGODB-AWS and client : Database(MongoClient(host=['myproject.80ebt.mongodb.net:27017'], document_class=dict, tz_aware=False, connect=True, authmechanism='MONGODB-AWS'), 'mydatabase')
2023-04-25T18:15:22.326Z 783af7f1-6238-4b05-96d5-2e2798888d56 Task timed out after 5.01 seconds
- The uri looks like : mongodb+srv://:@project_name.80ebt.mongodb.net/?authSource=%24external&authMechanism=MONGODB-AWS&retryWrites=true&w=majority&authMechanismProperties=AWS_SESSION_TOKEN:<session token (for AWS IAM Roles)>
All these tests were made using pymongo[aws]==4.3.3.
Really appreciate your help on this,
Tom
