Bobcares

Install MongoDB AWS Cloud9 | How To?

by | Dec 25, 2022

Let’s see a step-by-step method to install MongoDB using AWS Cloud9. At Bobcares, with our AWS Support Services, we can handle your AWS issues.

How to install MongoDB using AWS Cloud9?

AWS Cloud9 is an efficient development environment. It offers an effective code-editing experience, with support for various programming languages, runtime debuggers, and a built-in terminal. It’s a collection of tools for creating, producing, executing, testing, and debugging software, as well as publishing it to the cloud.

Amazon DocumentDB is a non-relational database service built from the bottom up to provide the speed, scalability, and availability required for scaling mission-critical MongoDB applications.

Installing Amazon DocumentDB (with MongoDB compatibility) using AWS Cloud9

The process of installing Amazon DocumentDB (with MongoDB compatibility) using AWS Cloud9 includes the following steps:

  1. AWS Cloud9 environment creation
  2. Security group creation
  3. Amazon DocumentDB cluster creation
  4. Mongo shell installation
  5. Connect the Amazon DocumentDB cluster
AWS Cloud9 environment creation
  1. Navigate to the AWS Cloud9 console via the AWS Management Console and select Create environment.
  2. Enter “DocumentDBCloud9” in the Name field of the Environment name and description section.
  3. Select the Next step.
  4. Again select the Next step in the Configure settings section.
  5. Select Create environment in the Review section.
Security group creation
  1. Select Security groups from the Network and Security menu in the Amazon EC2 Management Console.
  2. Select Create security group.
  3. Provide the following for each field in the Basic details box: for the Security group name, enter demoDocDB, for Description, enter a description, and for VPC, accept the usage of the default VPC.
  4. Choose Add rule in the Inbound rules section.
  5. Select Custom TCP Rule for Type.
  6. For the Port range, provide 27017.
  7. The source is the security group for the newly built AWS Cloud9 environment. Enter cloud9 in the destination field to obtain a list of possible security groups. Select the security group named aws-cloud9-<environment name>.
  8. Accept all other defaults. Select Create a security group.
Amazon DocumentDB cluster creation
  1. Select Create from the Clusters menu in the Amazon DocumentDB management console.
  2. In the Configuration section of the Create Amazon DocumentDB cluster page, select 1 for the Number of instances. The remaining options in the Configuration section can be left alone.
  3. Enter a username and password in the Authentication area.
  4. Enable Show advanced settings.
  5. Choose demoDocDB in the Network settings section for VPC security groups.
  6. Select Create cluster.
Mongo shell installation
  1. If the AWS Cloud9 environment from Step 1 is still open, return to it and skip to instruction 3. If we went away from the AWS Cloud9 environment, locate the environment labeled DocumentDBCloud9 in the AWS Cloud9 management dashboard, under Your environments. Select Open IDE.
  2. Create the repository file at the command prompt by using the following command:
    echo -e "[mongodb-org-4.0] \nname=MongoDB Repository\nbaseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/4.0/x86_64/\ngpgcheck=1 \nenabled=1 \ngpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc" | sudo tee /etc/yum.repos.d/mongodb-org-4.0.repo
  3. Then use the following command to install the mongo shell:
    sudo yum install -y mongodb-org-shell
Connect the Amazon DocumentDB cluster
  1. Locate the cluster in the Amazon DocumentDB management dashboard under Clusters. By clicking on the cluster identifier, we can select the cluster we built.
  2. Copy the connection string provided on the Connectivity and Security tab, under Connect to this cluster using the mongo shell. Avoid the portion so that mongo shell will prompt for a password when we connect.
  3. Return to the AWS Cloud9 instance and paste the connection string.

We successfully install MongoDB using AWS Cloud9 when we input the password and the prompt changed to rs0:PRIMARY>.

[Searching for a solution to a different AWS query? We’re available 24/7.]

Conclusion

To conclude, we have provided a detailed description of installing MongoDB using AWS Cloud9 which includes four steps namely, AWS Cloud9 environment creation, Security group creation, Amazon DocumentDB cluster creation, Mongo shell installation, and Connecting the Amazon DocumentDB cluster.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.