๐ Initial Setup and access for Atlas CLI
Run this section in your notebook
You can clone our template or use it in one of the online environments: https://github.com/mongodb-developer/security-lab-notebooks/blob/main/template_notebook.ipynb
Important! Each code that needs to be edited is marked with <CODE_BLOCK>
.
This section will cover the required notebook operations that must be fulfilled to run the Challenges.
1. Install atlas CLI on the notebook environment.โ
# Install atlas-cli
!wget https://fastdl.mongodb.org/mongocli/mongodb-atlas-cli_1.37.0_linux_x86_64.deb
!dpkg -i mongodb-atlas-cli_1.37.0_linux_x86_64.deb
# If you require sudo privilege, run the following instead:
# !sudo dpkg -i mongodb-atlas-cli_1.37.0_linux_x86_64.deb
2. Authenticate the CLI against your Atlas organization.โ
atlas auth login
typically enters interactive mode.
We are piping a new line character so that it selects a default organization for you.
# Authenticate with Atlas CLI
!echo -e "\n" | atlas auth login --noBrowser
Important! This task requires you to click the connect link https://account.mongodb.com/account/connect and input the 8 digit code prompted.
Once logged in you should see a success mark on that cell.
Expand to see example
Run the cell and get the verification code as well as the authentication link and open it in a new tab:

Proceed to login into https://account.mongodb.com/account/connect and provide the code in the opened authentication tab:

Confirm the CLI access and go back to the notebook:

You should see an output in the notebook cell similar to:
To verify your account, copy your one-time verification code:
X9G4-KP98
Paste the code in the browser when prompted to activate your Atlas CLI. Your code will expire after 10 minutes.
To continue, go to https://account.mongodb.com/account/connect
Successfully logged in as pavel.duchovny@mongodb.com.
...
Take a note of the relevant Organization ID for next steps and "STOP" the cell.

Take a note of the relevant Organization ID for next step.
3. Create a new project called "MySecureProj"โ
Replace <ORGANIZATION_ID>
with the Organization ID from the previous step.
# Retain the quotes ("") when pasting the Organization ID
org_id = "<ORGANIZATION_ID>"
!atlas projects create MySecureProj --orgId {org_id}
There should be an output which shows the Project ID of the project created. Use this Project ID for the next step.
4. Create your challenge clusterโ
Replace <PROJECT_ID>
with the Project ID from the previous step.
# Retain the quotes ("") when pasting the Project ID
project_id = "<PROJECT_ID>"
# You may select a region closer to you instead of "US_EAST_1"
!atlas clusters create MyNewCluster --provider AWS --region US_EAST_1 --tier M0 --projectId {project_id}
Next Stepsโ
Progress to Network Setup for authorising access to your Atlas deployment.