Setting up the Database Using Atlas CLI

Let's learn how to set up a MongoDB database using Atlas CLI.

In this lesson, we explore an alternative way to set up our database. Before we can start, we need to install Atlas CLI. If you’d like, you can use the commands given below to install Atlas CLI on your local machine.

Note: Installation on your local machine is not required for this course. Everything can be done in the browser terminal.

  1. The following command installs the prerequisite for atlas:
$ sudo apt-get install gnupg
  1. The following command imports the public GPG key for MongoDB:
$ wget -qO - | sudo apt-key add -
  1. The following command creates a list file for our version of Ubuntu (18.04):
$ echo "deb [ arch=amd64,arm64 ] bionic/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
  1. This command updates the package database:
$ sudo apt-get update
  1. The following commands installs the atlas cli:
$ sudo apt-get install -y mongodb-atlas
  1. Enter the following command to verify success of installation:
$ atlas

Creating a new project and generating API keys

Follow the steps in the slides below to create a new project and set up its API keys:

Get hands-on with 1200+ tech skills courses.