Connecting to Endpoints
When you have your endpoint, either cluster or instance, you can connect to it using the mongo shell or a connection string.
Connecting Using the mongo Shell
Use the following structure to construct the string that you need to connect to your cluster or instance using the mongo shell:
1. mongo \
2. --ssl \
3. --host Endpoint:Port \
4. --sslCAFile rds-combined-ca-bundle.pem \
5. --username UserName \
6. --password Password
mongo shell examples
Connect to a cluster:
1. mongo \
2. --ssl \
3. --host sample-cluster.corcjozrlsfc.us-east-1.docdb.amazonaws.com:27017 \
4. --sslCAFile rds-combined-ca-bundle.pem \
5. --username UserName \
6. --password Password
Connect to an instance:
1. mongo \
2. --ssl \
3. --host sample-cluster-instance.corcjozrlsfc.us-east-1.docdb.amazonaws.com:27017 \
4. --sslCAFile rds-combined-ca-bundle.pem \
5. --username UserName \
6. --password Password
Connecting Using a Connection String
Use the following structure to construct the connection string that you need to connect to your cluster or instance.
1. mongodb://UserName:Password@endpoint:port?replicaSet=rs0&ssl_ca_certs=rds-combined-ca-bundle.pem
Connection string examples
Connect to a cluster:
1. mongodb://UserName:Password@sample-cluster.cluster-corlsfccjozr.us-east-1.docdb.amazonaws.com:27017?replicaSet=rs0&ssl_ca_certs=rds-combined-ca-bundle.pem
Connect to an instance:
1. mongodb://UserName:Password@sample-cluster-instance.cluster-corlsfccjozr.us-east-1.docdb.amazonaws.com:27017?replicaSet=rs0&ssl_ca_certs=rds-combined-ca-bundle.pem
