Create and Configure an Atlas Cluster
This tutorial demonstrates how to use the atlas quickstart
command to:
Create one cluster in your Atlas project.
Load sample data into your Atlas cluster.
Add your IP address to your project's IP access list.
Create a MongoDB user for your Atlas cluster.
Connect to your new cluster using the MongoDB Shell,
mongosh
.
To perform all of these steps while also creating a new Atlas account, see Get Started with Atlas.
To create a cluster using a configuration file, run the
atlas clusters create command with the --file
option instead
of atlas quickstart
. To learn more about the configuration file
for an Atlas cluster, see Cluster Configuration File.
Prerequisites
Before you begin, complete the following tasks:
Configure an Atlas Cluster
Use the atlas quickstart
command to create an M0
cluster in Atlas. M0
clusters have some operational limitations.
You can run this command in the following ways:
- Default settings mode: the command creates a sample shared-tier cluster with the
- default settings.
Interactive mode: the command prompts you for the cluster settings and provides default values.
Noninteractive mode: you run the command with the options.
Click the tab to see the command for your preferred mode.
The command creates a sample shared-tier cluster with the following default settings:
Cluster name:
Quickstart-<number>
Service provider:
AWS
Provider region:
US_EAST_1
Cluster tier:
M0
Disk size:
0.5
GBDatabase Username:
Quickstart-<number>
Database User Password:
abcdef12345
Allow connections from IP Address:
<YourIPAddress>
Load Sample Data:
Yes
Open Shell:
No
Note
The password is a random autogenerated value. abcdef12345
is an example value.
atlas quickstart --default --force
We are deploying Quickstart-9876543... Creating your cluster... [Its safe to 'Ctrl + C'] Loading sample data into your cluster... [Its safe to 'Ctrl + C'] Now you can connect to your Atlas cluster with: mongosh -u Quickstart-9876543 -p abcdef12345 mongodb+srv://quickstart-9876543.example.mongodb.net
The command prompts you for the cluster settings and provides
default options. Press Enter
when prompted to accept the
default settings.
atlas quickstart
You are creating a new Atlas cluster and enabling access to it. Press [Enter] to use the default values. Enter [?] on any option to get help. [Set up your Atlas cluster] ? Cluster Name [This cant be changed later] Quickstart-9876543 ? Cloud Provider AWS ? Cloud Provider Region US_EAST_1 ? Do you want to load sample data into Quickstart-9876543? Yes [Set up your database authentication access details] ? Database User Username Quickstart-2345678 ? Database User Password [Press Enter to use an auto-generated password 'abcdef12345'] abcdef12345 [Set up your database network access details] ? Access List Entry [Press Enter to use your public IP address '192.0.2.0'] 192.0.2.0 [Connect to Quickstart-9876543] ? Do you want to access Quickstart-9876543 with MongoDB Shell? Yes [Summary of changes] Cluster Name: Quickstart-9876543 Cluster Tier: M0 Cloud Provider: AWS Region: US_EAST_1 Cluster Disk Size (GiB): 0.5 Database Username: Quickstart-9876543 Allow connections from (IP Address): 192.0.2.0 Load sample data: Yes Open shell: No ? Do you want to create a new cluster Quickstart-9876543 with the following settings? Yes We are deploying Quickstart-9876543... Creating your cluster... [Its safe to 'Ctrl + C'] Loading sample data into your cluster... [Its safe to 'Ctrl + C'] Now you can connect to your Atlas cluster with: mongosh -u Quickstart-9876543 -p abcdef12345 mongodb+srv://quickstart-9876543.example.mongodb.net
The command creates a sample shared-tier cluster with the following settings:
Cluster name:
getStarted
Service provider:
AWS
Provider region:
US_EAST-1
Cluster tier:
M0
Disk size:
2
GBMongoDB version:
5.0
Replica set members:
3
atlas quickstart --clusterName getStarted --provider AWS --region US_EAST_1 --username testUser --password changeMe accessListIp 192.0.2.15 --skipSampleData
You are creating a new Atlas cluster and enabling access to it. Press [Enter] to use the default values. Enter [?] on any option to get help. [Set up your database network access details] ? Access List Entry [Press Enter to use your public IP address '192.0.2.15'] 192.0.2.15 [Connect to getStarted] ? Do you want to access getStarted with MongoDB Shell? Yes [Summary of changes] Cluster Name: getStarted Cluster Tier: M0 Cloud Provider: AWS Region: US_EAST_1 Cluster Disk Size (GiB): 0.5 Database Username: testUser Allow connections from (IP Address): 192.0.2.15 Load sample data: No Open shell: No ? Do you want to create a new cluster getStarted with the following settings? Yes We are deploying getStarted... Creating your cluster... [Its safe to 'Ctrl + C'] Now you can connect to your |service| cluster with: mongosh -u testUser -p changeMe mongodb+srv://getStarted.example.mongodb.net
Take the Next Steps
Congratulations! You have successfully created a cluster to host your data.
Use the connection string
to connect to your cluster through mongosh
or your application.
To view the status of your cluster:
Run an
atlas clusters
command in the Atlas CLI.