3

I Have my own AWS DocumentDB and I'm trying to connect to it in R using Mongolite Package

I tried to do this with mongolite ssl_options with this code:

mong <- mongo(collection = "test", db = "test"
              ,url ='*******************.docdb.amazonaws.com:27017'
              ,verbose = TRUE
              ,options = ssl_options(ca= 'rds-combined-ca-bundle.pem',weak_cert_validation = T)
              )

But I get this Error :

> Error: No suitable servers found (`serverSelectionTryOnce` set):
> [socket timeout calling ismaster on
> '***********************-central-1.docdb.amazonaws.com:27017']

so i need someone how can solve this problem.

omarahmedm93
  • 71
  • 1
  • 8

1 Answers1

1

You can connect to Amazon DocumentDB using TLS and the Mongolite package (https://jeroen.github.io/mongolite/index.html) using the following example connection string:

j <- mongo(url = "mongodb://<yourUsername>:<yourPassword>@docdb-2019-02-21-02-57-28.cluster-ccuszbx3pn5e.us-east-1.docdb.amazonaws.com:27017/?ssl=true", options = ssl_options(weak_cert_validation = T, key = "rds-combined-ca-bundle.pem"))

The error you are seeing typically occurs when 1/the URL for the host (Amazon DocumentDB cluster) in the connection string is incorrect or does not match that of the cluster you are trying to connect to or 2/your client machine that you are issuing the connection from is in a different region or VPC than your Amazon DocumentDB cluster.

For additional troubleshooting: https://docs.aws.amazon.com/documentdb/latest/developerguide/troubleshooting.html

Joseph Idziorek
  • 4,853
  • 6
  • 23
  • 37