AWS SSH tunnel fail to connect to MongoDB Atlas Cluster
Answered
Hi,
I have the version 6.0.4 version of the app.
I am having problem connecting to MongoDB Atlas Cluster via the SSH tunnel, I keep getting the following error.
I can connect to the MongoDB Atlas Cluster when:
- I connect to it directly without SSH Tunnel from my local Ubuntu PC
- I connect to it directly via mongo from the AWS Ubuntu Server
I have created test Ubuntu AWS server and MongoDB Cluster that you can use to replicate this issue with.
Here is the Connection String used in NoSQLBooster:
mongodb+srv://tempUser:temp123@test-cluster.xqwpe.mongodb.net/test?retryWrites=true&w=majorityHere is the command to connect to the cluster from the AWS server:
./mongo "mongodb+srv://test-cluster.xqwpe.mongodb.net/test" --username tempUserHere is command used to connect to the AWS Server:
ssh -i "temp_key.pem" ubuntu@ec2-13-48-236-196.eu-north-1.compute.amazonaws.comHere is the content of the temp_key.pem file:
-----BEGIN RSA PRIVATE KEY----- MIIEpAIBAAKCAQEAgLfkqfqOFs6bxiyp9QHkd9EO2CfCrus/8ct2U58MDkPIRYkD4e1ER6NFKeAr +f5xUF0qPpQ4jzq7BY//+QFGttARqCG9dmZtb3rN4QFiq53+zjSiidkGr2g7qL0fEGC0cFTXNZ3c FVD6nyGsSy5cH0CrlVS/4EqnxanAKNCaJsZ+NhRUhO3cdb3JYHDA8rGDBSaD7oP/hCAmZ4Gdl7yL 8qW18Ce3giPd//2PGnmQavJPmHvTMfUN1DYv/k90nrwtYFOH1nj0NsDE88jP6qKU5ET21ymAL8uV XIbGcmh/s0cZJ8aWMKT5sYvRehIh3bHW7WglK5uK8Oqhote6VclqsQIDAQABAoIBAAv4DY04vSml wJpm4M7lhCcYC3dSCypUubd0IeaYrXhOGTtOCExj0auPpQjFzZELdeHxJ9J12eSHo4ha4YR39+lb 46hsqr9tutNY6ff4NwKaSG1IO6zxv0tkN9fy7gaJ131yhih4K1TYGNXfPbQn9Wz6iHn0TXs/teYN aM7ixtLAFHhxSEK/ZkaZ55EmS+mS1yXtvC1byoWU/Ks29vRbw5SXJN7exjfsamSUUmHRpWUKNZr2 FszzzJstsesPHCJOvDfzGQrAEuWGCFBA27h19tif1jMe0/0QyytotRMNgCAY+Fp41SvWKq4D3yqD yTnOTC/iUYEHGAiP5rHrl2pjA4ECgYEAwszdbn4FcdR/EKVT4RyhgpSe07BB8UyDpG/13olGpRU0 RkZvBAzko6053PsgdYq7KU1o+kEwTJEVz5X/YWjp39g8Ar5NCgUV82RGTH+ghtkyhpwgukmCNdYi /mk+rVoZdS44sGhLyLrhAkfNQ6y5D9Z0SNlYav8aBozighHUFlkCgYEAqShHlqEtb4C5Cxt8cPBp iJlTQeICNSS6aD/Q4p/HpypJzYJqmnnB3G83WM5wPiJafmDDSxNxQrECFZnBcq2X446shkbsE6Gf e67iCrbN/k6tVM0DQ+37u0NZbU60kYEKVZw+2j6BE+LQ50sDmPp2+Lxx6XSZnicVnXIc0dl9nBkC gYEAsmzrNVWAry6v5BNKrRqIZQ60G7mJ7PbkbS2PyvF6H6M4alYBQXh9w93a7imnJYKYw8//o5kq IDeT/rupWxO5hCqPbQPZlJ/r5y+lpFQSOPGgceN3pqnF9oHZM6Y6npW0U7yueAZPw+BIUMprnN0L 9RG9GSza68YVlIJexjyGQqECgYAK/tdIb0moydE9a5f3L2lsu6qxyaMjGTQUurE1SfWMZC9P8H5F dEypq4EJgMHDCDChrmCDbMwb7a2ZAdmVPrt0yz1jrRCDZiobvA5ta9yP/0U9EeZ4b+vBDGuvs0IB g0XMss9TGGUDiebSYgnl08IQAQ/WgQHLSfcZuOUurth/YQKBgQC/vwgIOllh5Fl6Y5uD1GukdZz3 pq4SCWTFQvxjDMCO6B8MqUM0xvm0sSo3grVpkxiJnnY+KtKPFzTfFShj5im/wZy3Ex0yxFeuy7qC YUXzHVZjprv3nN1xqqyzapVRGP0SJ4+j91h0IGkaCfFBAL9rtcbIPgap/l8KoBolqzED9A== -----END RSA PRIVATE KEY-----
Let me know once you are done with the server and cluster, so that i can remove them. :-)
Best Regards,
Chew
I tried your connection without SSH. It failed, please check your mongodb URI.
By the way, I passed the database connection test for the MongoDB M121 course over my SSH tunnel. Here is the connection URI:
mongodb://m121:aggregations@cluster0-shard-00-00-jxeqq.mongodb.net:27017/aggregations?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin&ext.ssh.server=example.com:22&ext.ssh.username=ubuntu&ext.ssh.keyPath=C:\Users\qinghai\.ssh\test.pem
I tried your connection without SSH. It failed, please check your mongodb URI.
By the way, I passed the database connection test for the MongoDB M121 course over my SSH tunnel. Here is the connection URI:
mongodb://m121:aggregations@cluster0-shard-00-00-jxeqq.mongodb.net:27017/aggregations?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin&ext.ssh.server=example.com:22&ext.ssh.username=ubuntu&ext.ssh.keyPath=C:\Users\qinghai\.ssh\test.pem
Just in case it is due to something I set, here are how I set them in the app:
Just in case it is due to something I set, here are how I set them in the app:
NoSQLBooster does not support DNS Seedlist Connection (mongodb+srv:) over an ssh tunnel. Instead, you can use the standard connection string format on the ssh tunnel
(mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/?replicaSet=myRepl)
NoSQLBooster does not support DNS Seedlist Connection (mongodb+srv:) over an ssh tunnel. Instead, you can use the standard connection string format on the ssh tunnel
(mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/?replicaSet=myRepl)
Hi,
I have tried your suggestion.
But when i tried to test the connection i get this error when using with SSH Tunnel.
The test is successful when tested with SSH Tunnel off:
Hi,
I have tried your suggestion.
But when i tried to test the connection i get this error when using with SSH Tunnel.
The test is successful when tested with SSH Tunnel off:
Replies have been locked on this page!