How to Create AWS DocumentDB and Connect [3 steps]

In this article, We are going to perform Create AWS DocumentDB, connect to AWS DocumentDB, AWS DocumentDB create Database, Create SSH Tunnel to connect AWS DocumentDB.

What is DocumentDB in AWS ?

DocumentDB is managed No-SQL Database service provided by AWS.

First login AWS DocumentDB console with UserName and Password and Click on Launch AWS DocumentDB

Step #1: Creating Parameter Group for DocumentDB

Before creating DocumentDB cluster in AWS , Here we are creating for demo purpose , create Parameter groups to disable securing settings.

Click on Parameter groups on Left side.


Input New Parameter Group Name and Description and Click on Create button.


once created, you can see your parameter groups in DocumentDB , Click on it.


By default tls and ttl_monitor enabled , Click on it and change from enabled to disabled as shown above

Step #2: Creating Subnet Group for AWS DocumentDB Cluster

create subnet groups for DocumentDB



Input Subnet Group Name and Description


Add VPC, Availability Zone, Subnets and Click on Create Button

Step #3: Create AWS DocumentDB

Click on Clusters , clink on Create on Left side and Below screen will appear


Input your AWS DocumentDB configuration and Authentication details.


Add Network Settings and Cluster Options , Next you have options to add Encryption-at-rest, Backup, Log Exports and Maintenance settings


Add Tags, Enable Deletion Protection and Click on Create Cluster , You will see cluster creating status.


once created, you can see Available status, Click on your cluster


You can see below options to connect AWS documentdb i.e connect documentdb using mongo shell and with application


Connect to DocumentDB from EC2

By default, AWS document DB does not allow connect publicly so we have added in within VPC which is recommended.

Create an EC2 in AWS within Same VPC where AWS DocumentDB resides means EC2 and DocumentDB should be Same VPC.

Once EC2 instance created , Login to EC2 instance and Install Mongo Shell on it using below command, Here I have created Ubuntu Instance

sudo apt update
sudo apt install mongodb-clients

Now connect to DocumentDB using connection Strings with password

mongo --host --username devopshint --password devopshint123


MongoDB shell version v3.6.8
connecting to:
Implicit session: session { "id" : UUID("81e6b3ff-90eb-4d46-b559-1d9e2edbde15") }
MongoDB server version: 3.6.0

List database in DocumentDB

rs0:PRIMARY> show dbs

Create Database in AWS DocumentDB

rs0:PRIMARY> use devopshint
switched to db devopshint

To check Number of connections to DocumentDB

rs0:PRIMARY> db.runCommand( { serverStatus: 1 })


In this article, We are going to perform Create AWS DocumentDB, connect to AWS DocumentDB, AWS DocumentDB create Database, Create SSH Tunnel to connect AWS DocumentDB from EC2

Related Articles

How to Install MySQL 5.7 on Amazon Linux 2

How to Enable Password Authentication for AWS EC2

How to Connect EC2 Instance using Putty

How to Transfer files to AWS Instance using WinSCP [2 Steps]

How to connect to AWS EC2 Instance using MobaXTerm

20 AWS Interview Questions and Answers

push docker image to AWS ECR


AWS DocumentDB official Guide

About DevOps Hint

DevOps Hint Founded in 2020 Community Site where you can find about How to Guides, Articles and Troubleshooting Tips for DevOps, SRE, Sysadmins and Developers.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share via
Copy link