Objective
Connect to a DocumentDB instance that has been created on Spinup.
Introduction
Spinup offers a service around DocumentDB, a NoSQL document database provided by Amazon Web Services (AWS), that is designed to be compatible with MongoDB. In this guide, you will learn how to connect with you DocumentDB instance after having created it on Spinup. There are several options to connect, including the Studio3T graphical user interface (GUI), or through command-line interface (CLI) via a linux server.
GUI with Studio3T
Download and install Studio3T
Click 'Connect' at the top, then click 'New connection'. Choose Manually configure my connection settings
Under the 'Server' tab, fill out the Connection name. Choose Standalone as the 'Connection Type'. Copy the endpoint from the details page of your DocumentDB and fill it out next to Server.
Under the 'Authentication' tab, choose Legacy (SCRAM-SHA-1) as the 'Authentication Mode'. Fill out the User name and Password from when you created the DocumentDB. Use a custom database name for the Authentication DB field (admin
does not work for Amazon DocumentDB clusters with no databases. Once you have created your first database you can modify your connection to use admin
, if you wish.)
Download this new CA certificate from AWS. Under the 'SSL' tab, choose Use SSL protocol to connect' Then, select the Use own Root CA file (–sslCAFile) option and browse to the rds-combined-ca-bundle.pem
certificate file that was just downloaded using the folder icon on the right.
Navigate back to Spinup, and under the 'Firewall' tab on your Space's home page, add Port 27017 as an inbound rule. Choose Other (custom) as the 'Service', 27017 as the 'Port', and select Anywhere for the 'Source IP subnet' (for further information: How do I use the Firewall in Spinup Spaces?)
In Studio3T, in the 'New Connection' window, click Test Connection on the bottom left. If the test succeeds, you can Save your new connection, and under the 'Connection Manager' window, you can Connect with the DocumentDB (should be under Local Resources).
CLI
Follow the instructions for your computer on the MongoDB website to install the MongoDB Shell. These are the commands I ran for Ubuntu 22.04:
wget -qO- https://www.mongodb.org/static/pgp/server-7.0.asc | sudo tee /etc/apt/trusted.gpg.d/server-7.0.asc
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
sudo apt-get update
sudo apt-get install -y mongodb-mongosh
Download the CA certificate from AWS.
wget https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem
Navigate back to Spinup, and under the 'Firewall' tab on your Space's home page, add Port 27017 as an inbound rule. Choose Other (custom) as the 'Service', 27017 as the 'Port', and select Anywhere for the 'Source IP subnet' (for further information: How do I use the Firewall in Spinup Spaces?)
Follow the instructions to connect to a deployment on a remote host. Copy the endpoint from the details page of your DocumentDB.
mongosh -tls <cluster endpoint>:27017 --username <username> --tlsCAFile rds-combined-ca-bundle.pem
# Example
# mongosh -tls spinup-docdb00245c.cluster-c9ukc6s0rmbg.us-east-1.docdb.amazonaws.com:27017 --username test1234 --tlsCAFile rds-combined-ca-bundle.pem
Related articles
-
Page:
-
Page:
-
Page:
-
Page:
-
Page: