Navigation

mongocli atlas quickstart

The mongocli atlas quickstart command creates an M2 cluster in the specified Atlas project. You can either specify the options with the command or omit the options and run the command in interactive mode. That is, if you do not specify one or more required options with the command, the command prompts you for the settings for those options. If you do not yet have a default profile, the command provides the links to:

Use this command to get started with MongoDB Atlas.

Note

The command takes a few minutes to create the cluster; you can press Ctrl+C to return to the command line while the operation completes in the background.

mongocli atlas quickstart
--accessListIp <IP-addresses>
--clusterName <cluster-name>
--password <user-password>
--profile|-P <profile-name>
--projectId <project-ID>
--provider AWS|GCP|AZURE
--region|-r <region-name>
--skipMongosh
--username <name-of-user>
Note

Use -h or --help to view the command-line help for this command.

All of the following options are required to run the command in non-interactive mode. To run the command in interactive mode, you don't need to specify any of the following options with the command.

Option
Type
Description
--accessListIp
string
List of IP addresses to add to the project access list. Atlas only allows connections to a cluster from addresses listed in the IP access list. If you do not specify an IP address, MongoDB CLI detects and adds your public IP address to the project access list.
--clusterName
string
Name of the cluster. The cluster name cannot be changed after you create the cluster. Cluster name can contain ASCII letters, numbers, and hyphen. If you do not specify a name for the cluster, defaults to Quickstart_{epoch} where {epoch} is the date range represented as milliseconds elapsed since the UNIX epoch.
--password
string
Password for authenticating the user to MongoDB using SCRAM-SHA. In interactive mode, MongoDB CLI auto-generates a password in interactive mode if you do not specify a password.
--profile, -P
string
Name of the profile where the public and private keys for the project are set. If omitted, uses the default profile. To learn more about creating a profile, see Configure the MongoDB CLI.
--projectId
string

Unique identifier of the project. If omitted, uses the project ID in the profile or environment variable.

--provider
string

Cloud service provider on which the servers are provisioned. Value can be:

  • AWS - Amazon AWS
  • GCP - Google Cloud Platform
  • AZURE - Microsoft Azure

If you do not specify the provider, defaults to AWS.

--region, -r
string

Physical location of the MongoDB cluster. Select your cloud provider tab to view the available regions:

  • US_EAST_1
  • US_WEST_2
  • EU_WEST_1

For a complete list of supported AWS regions, see Amazon Web Services (AWS). If you don't specify a region, defaults to US_EAST_1.

--skipMongosh
boolean

Flag that specifies whether or not to download and install the mongo shell for accessing the cluster using the mongo shell. In interactive mode, you can specify one of the following values:

  • Y - to specify the path to the mongo shell if it is already installed your system or to download and install the mongo shell.
  • N - to not download and install the mongo shell

If you do not specify a value, defaults to N.

--username
string
Username for authenticating the user to MongoDB. In interactive mode, the default value is the same as the default cluster name.

If the command succeeds, the command prints the following output to the terminal.

Now you can connect to your Atlas cluster with: mongosh -u <username> -p <user-password> mongodb+srv://<cluster-name>.7hgjn.mongodb.net

The command prints output similar to the following to the terminal if you run the command in the background by pressing Ctrl+C.

You can connect to your Atlas cluster with the following user:
username: <username>
password: <user-password>

If the command returns errors, see Troubleshooting for recommended solutions.

The following mongocli atlas quickstart commands create a cluster named QuickstartCluster in the Atlas project. The command uses the default profile for accessing the Atlas project.

mongocli atlas quickstart --clusterName QuickstartCluster --provider AWS --region US_EAST_1 --username testUser --password changeMe --accessListIp 192.0.2.15 --skipMongosh

The command prints the following output to the terminal after it completes:

Now you can connect to your Atlas cluster with: mongosh -u testUser -p changeMe mongodb+srv://quickstart-1616794174.7hgjn.mongodb.net

The command prints the following to the terminal if you press Ctrl+C:

You can connect to your Atlas cluster with the following user:
username: testUser
password: changeMe
Give Feedback