Navigation

Alpha Release of MongoDB CLI

This is a pre-release early version of MongoDB CLI. Do not use MongoDB CLI to manage production environments.

mongocli atlas cluster create

On this page

The cluster create command creates a cluster in the specified project. You can also create a cluster with the Atlas UI or API.

Syntax

mongocli atlas cluster create <cluster-name>
     [ --backup true|false ]
     [ --diskSizeGB <size-of-disk> ]
     [ --file|-f <path-to-cluster-config-file> ]
     [ --mdbVersion <mogodb-version>]
     [ --members|-m <number-of-members> ]
     [ --projectId <project-ID> ]
     [ --profile|-p <profile-name> ]
       --provider AWS|GCP|AZURE
       --region|-r <region-name>

Note

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

Options

Option Type Description Required?
--backup boolean

Flag to enable or disable backup on M10 and larger clusters. This option is not available for clusters smaller than M10. Value can be:

If omitted, defaults to false.

no
<cluster-name> string Name of the cluster. The cluster name cannot be changed after the cluster is created. Cluster name can contain ASCII letters, numbers, and hyphen. yes
--diskSizeGB int

Size of the disk in GB for storage. If omitted, uses the default disk size for the instance type. Select your cloud provider tab to view the default disk size for each instance type:

Instance Size Default Storage Default RAM
M2 2 GB Shared
M5 5 GB Shared
M10 10 GB 2 GB
M20 20 GB 4 GB
M30 40 GB 8 GB
M40 or R40 80 GB 16 GB
M40_NVME 380 GB 15.25 GB
M50 or R50 160 GB 32 GB
M50_NVME 760 GB 30.5 GB
M60 or R60 320 GB 64 GB
M60_NVME 1.6 TB 61 GB
M80 760 GB 131 GB
R80 750 GB 122 GB
M80_NVME 1.6 TB 122 GB
M100 1 TB 160 GB
M140 1 1 TB 192 GB
M200 or R200 1.5 TB 256 GB
M200_NVME 3.1 TB 244 GB
M300 1 2 TB 384 GB
R300 2 TB 384 GB
R400 3 TB 488 GB
M400_NVME 2 4 TB 512 GB
R700 4 TB 768 GB

1 Unavailable if providerSettings.regionName equals AP_SOUTHEAST_2.

2 Availability limited to the following regions: - US_EAST_1 - US_EAST_2 - US_WEST_2 - EU_WEST_1 - EU_CENTRAL_1 - AP_NORTHEAST_1

Cluster Tiers Default Storage Default RAM
M2 2 GB Shared
M5 5 GB Shared
M10 32 GB 2 GB
M20 32 GB 4 GB
M30 32 GB 8 GB
M40 128 GB 16 GB
M50 128 GB 32 GB
M60 128 GB 64 GB
M80 256 GB 128 GB
M200 256 GB 256 GB
Cluster Tiers Default Storage Default RAM
M2 2 GB Shared
M5 5 GB Shared
M10 10 GB 1.70 GB
M20 20 GB 3.75 GB
M30 40 GB 7.5 GB
M40 80 GB 15 GB
M50 160 GB 30 GB
M60 320 GB 60 GB
M80 750 GB 120 GB
M200 1.5 TB 240 GB
M300 1 2.2 TB 360 GB

1 Unavailable if providerSettings.regionName equals: - SOUTH_AMERICA_EAST_1 - EUROPE_WEST_3 - NORTHEASTERN_ASIA_PACIFIC - AUSTRALIA_SOUTHEAST_1

no
--file, -f string

Path to a JSON configuration file that defines cluster settings. Any settings specified in the configuration file take precedence over settings specified by a command option.

For a list of settings you can define, see the Create One Cluster API.

Note

You can’t create Global Clusters through the MongoDB CLI.

no
--mdbVersion string

Major version of the cluster to deploy. Value can be:

  • 4.2
  • 4.0 - for M10+ clusters only
  • 3.6 - for M10+ clusters only

By default, deploys v4.2.

no
--members, -m int Number of members in the replica set. The default value is 3. no
--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. no
--projectId string Unique identifier of the project where you want to create the cluster. If omitted, uses the project ID in the profile or environment variable. no
--provider string

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

  • AWS - Amazon AWS
  • GCP - Google Cloud Platform
  • AZURE - Microsoft Azure
yes
--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).

  • US_EAST_2
  • US_WEST
  • EUROPE_NORTH

For a complete list of supported Azure regions, see Microsoft Azure.

  • CENTRAL_US
  • WESTERN_EUROPE
  • EASTERN_ASIA_PACIFIC

For a complete list of supported GCP regions, see Google Cloud Platform (GCP).

yes

Output

The command prints the following fields in JSON format to the terminal if the command succeeds. If the command prints an error, see Troubleshooting for recommended solutions.

Field Description
autoScaling Configuration for automatically scaling cluster storage and tier.
autoscaling.diskGBEnabled

Specifies whether or not disk auto-scaling is enabled.

Value can be:

  • true if enabled
  • false if disabled

By default, disk auto-scaling is disabled.

backupEnabled

Specifies whether or not continuous backups is enabled. Value can be:

  • true if enabled
  • false if disabled
biConnector Configuration for BI Connector for Atlas on the cluster.
biConnector.enabled

Specifies whether or not BI Connector is enabled. Value can be:

  • true if enabled
  • false if disabled

The default value is false.

biConnector.readPreference

Specifies the read preference for BI Connector on the cluster. Value can be:

The default value is secondary if there are no analytics nodes in the cluster. If there analytics nodes in the cluster, the default value is analytics.

clusterType

Specifies the type of cluster. Value can be:

  • REPLICASET
  • SHARDED
  • GEOSHARDED

The default value is REPLICASET.

diskSizeGB Specifies the capacity, in GB, of the host’s root volume.
encryptionAtRestProvider Configuration for encryption-at-rest. Default value is NONE.
id Specifies the unique identifier of the cluster.
groupId

Specifies the unique identifier of the project.

Note

Groups and projects are synonymous terms. Your {GROUP-ID} is the same as your project ID.

mongoDBVersion Specifies the MongoDB version that is deployed.
mongoDBMajorVersion Specifies the major version of MongoDB that is deployed.
mongoURI Specifies the base connection string for the cluster.
MongoURIUpdated Specifies the timestamp in Timestamp in ISO 8601 date and time format in UTC when the connection string was last updated.
name Specifies the name of the cluster.
numShards

Specifies the numer of shards in the sharded cluster. Value can be:

  • 1 if the cluster is a replica set.
  • 2 or higher, up to 12, if the cluster is a sharded cluster.
paused

Specifies whether or not the cluster is paused. Value can be:

  • true if cluster is paused.
  • false if cluster is active.
providerBackupEnabled

Specifies whether or not Cloud Provider Snapshots is enabled. Value can be:

  • true if enabled.
  • false if disabled.
providerSettings Configuration for the provisioned servers on which MongoDB runs.
providerSettings.backingProviderName

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

  • AWS for Amazon AWS
  • GCP for Google Cloud Platform
  • AZURE for Microsot Azure
providerSettings.instanceSizeName

Specifies the name of the cluster tier used for Atlas cluster.

Instance Size Default Storage Default RAM
M2 2 GB Shared
M5 5 GB Shared
M10 10 GB 2 GB
M20 20 GB 4 GB
M30 40 GB 8 GB
M40 or R40 80 GB 16 GB
M40_NVME 380 GB 15.25 GB
M50 or R50 160 GB 32 GB
M50_NVME 760 GB 30.5 GB
M60 or R60 320 GB 64 GB
M60_NVME 1.6 TB 61 GB
M80 760 GB 131 GB
R80 750 GB 122 GB
M80_NVME 1.6 TB 122 GB
M100 1 TB 160 GB
M140 1 1 TB 192 GB
M200 or R200 1.5 TB 256 GB
M200_NVME 3.1 TB 244 GB
M300 1 2 TB 384 GB
R300 2 TB 384 GB
R400 3 TB 488 GB
M400_NVME 2 4 TB 512 GB
R700 4 TB 768 GB

1 Unavailable if providerSettings.regionName equals AP_SOUTHEAST_2.

2 Availability limited to the following regions: - US_EAST_1 - US_EAST_2 - US_WEST_2 - EU_WEST_1 - EU_CENTRAL_1 - AP_NORTHEAST_1

Cluster Tiers Default Storage Default RAM
M2 2 GB Shared
M5 5 GB Shared
M10 32 GB 2 GB
M20 32 GB 4 GB
M30 32 GB 8 GB
M40 128 GB 16 GB
M50 128 GB 32 GB
M60 128 GB 64 GB
M80 256 GB 128 GB
M200 256 GB 256 GB
Cluster Tiers Default Storage Default RAM
M2 2 GB Shared
M5 5 GB Shared
M10 10 GB 1.70 GB
M20 20 GB 3.75 GB
M30 40 GB 7.5 GB
M40 80 GB 15 GB
M50 160 GB 30 GB
M60 320 GB 60 GB
M80 750 GB 120 GB
M200 1.5 TB 240 GB
M300 1 2.2 TB 360 GB

1 Unavailable if providerSettings.regionName equals: - SOUTH_AMERICA_EAST_1 - EUROPE_WEST_3 - NORTHEASTERN_ASIA_PACIFIC - AUSTRALIA_SOUTHEAST_1

providerSettings.providerName

Specifies the name of the cloud service provider on which the server is provisioned. Value can be:

  • AWS for Amazon AWS
  • GCP for Google Cloud Platform
  • AZURE for Microsot Azure
providerSettings.regionName

Specifies the physical location of the cluster. For a complete list of regions, see cloud provider reference:

replicationFactor Specifies the number of replica set members in the cluster. The possible values are 3, 5, 7.
replicationSpec Configuration for each region in the cluster. Each element in this object represents a region where your cluster is deployed.
replicationSpec.<region>

Specifies the physical location of the region.

Each <region> object describes the region’s priority in elections and the number and type of MongoDB nodes Atlas deploys to the region.

replicationSpec.<region>.analyticsNodes Specifies the number of analytics nodes in the region. Analytics nodes are read-only, and can never become the primary.
replicationSpec.<region>.electableNodes Specifies the number of electable nodes in the region. Electable nodes can become the primary and can facilitate local reads.
replicationSpec.<region>.priority

Specifies the election priority of the region. The highest possible priority is 7, which identifies the Preferred Region of the cluster. Atlas places the primary node in the Preferred Region. The lowest possible priority is 0, which identifies a read-only region.

You can have any number of priority 0 read only regions. Priorities 1 through 7 are exclusive: only one region per cluster can be assigned a given priority.

replicationSpec.<region>.readOnlyNodes Specifies the number of read-only nodes in the region. Read-only nodes can never become the primary member, but can facilitate local reads.
replicationSpecs Configuration for each zone in a Global Cluster. Each object in this array represents a zone where Atlas deploys nodes for your Global Cluster.
replicationSpecs.id Specifies the unique identifier of the replication object.
replicationSpecs.numShards Specifies the number of shards to deploy in the specified zone.
replicationSpecs.zoneName Specifies the name for the zone in a Global Cluster.
replicationSpecs.regionConfig Configuration for the physical location of the region. Each regionsConfig object describes the region’s priority in elections and the number and type of MongoDB nodes that Atlas deploys to the region.
replicationSpecs[n].regionsConfig
.<regionName>.analyticsNodes
Specifies the number of analytics nodes to deploy in the region.
replicationSpecs[n].regionsConfig
.<regionName>.electableNodes
Number of electable nodes for Atlas to deploy to the region. Electable nodes can become the primary and can facilitate local reads.
replicationSpecs[n].regionsConfig
.<regionName>.priority
Election priority of the region. If you have regions with only read-only nodes, set this value to 0.
replicationSpecs[n].regionsConfig
.<regionName>.readOnlyNodes

Number of read-only nodes for Atlas to deploy to the region. Read-only nodes can never become the primary, but can facilitate local-reads.

Specify 0 if you do not want any read-only nodes in the region.

srvAddress The connection string for connecting to the Atlas cluster. The +srv modifier forces the connection to use TLS. The mongoURI parameter lists additional options.
stateName

The current status of the cluster. Value can be:

  • IDLE
  • CREATING
  • UPDATING
  • DELETING
  • DELETED
  • REPAIRING

Examples

Example 1

The following mongocli atlas cluster create command creates a sample M2 cluster named myCluster in the AWS region US_EAST_1 with 3 nodes. The command uses the profile named egAtlasProfile, which contains the public and private keys for accessing Atlas.

~ mongocli atlas cluster create myCluster --projectId 5e2211c17a3e5a48f5497de3 --provider AWS --region US_EAST_1 --members 3 --instanceSize M2 --mdbVersion 4.2 --diskSizeGB 2 --profile egAtlasProfile

The command prints the following to the terminal. To learn more about these fields, see Output.

{
         "autoScaling": {
                  "diskGBEnabled": false
         },
         "backupEnabled": false,
         "biConnector": {
                  "enabled": false,
                  "readPreference": "secondary"
         },
         "clusterType": "REPLICASET",
         "diskSizeGB": 2,
         "encryptionAtRestProvider": "NONE",
         "id": "5e272af4f10fab7c87718918",
         "groupId": "5e2211c17a3e5a48f5497de3",
         "mongoDBVersion": "4.2.2",
         "mongoDBMajorVersion": "4.2",
         "mongoURIUpdated": "2020-01-21T16:46:44Z",
         "name": "myCluster",
         "numShards": 1,
         "paused": false,
         "providerBackupEnabled": false,
         "providerSettings": {
                  "backingProviderName": "AWS",
                  "instanceSizeName": "M2",
                  "providerName": "TENANT",
                  "regionName": "US_EAST_1"
         },
         "replicationFactor": 3,
         "replicationSpec": {
                  "US_EAST_1": {
                            "analyticsNodes": 0,
                                  "electableNodes": 3,
                            "priority": 7,
                            "readOnlyNodes": 0
                  }
         },
       "replicationSpecs": [{
                        "id": "5e272af4f10fab7c87718912",
                        "numShards": 1,
                        "zoneName": "Zone 1",
                        "regionsConfig": {
                                  "US_EAST_1": {
                                          "analyticsNodes": 0,
                                          "electableNodes": 3,
                                          "priority": 7,
                                          "readOnlyNodes": 0
                                  }
                        }
             }],
         "stateName": "CREATING"
}

Example 2

The following mongocli atlas cluster create command creates a sample M40 cluster named myCluster in the AWS region US_EAST_1 with 3 nodes with a configuration file. The command uses the profile named egAtlasProfile, which contains the public and private keys for accessing Atlas.

~ mongocli atlas cluster create myCluster --file cluster-config.json --projectId 5e2211c17a3e5a48f5497de3 --profile egAtlasProfile

The cluster configuration file contains the following settings:

{
  "name": "myCluster",
  "diskSizeGB": 100,
  "numShards": 1,
  "providerSettings": {
    "providerName": "AWS",
    "diskIOPS": 300,
    "instanceSizeName": "M40",
    "regionName": "US_EAST_1"
  },
  "clusterType" : "REPLICASET",
  "replicationFactor": 3,
  "replicationSpecs": [{
    "numShards": 1,
    "regionsConfig": {
      "US_EAST_1": {
        "analyticsNodes": 0,
        "electableNodes": 3,
        "priority": 7,
        "readOnlyNodes": 0
      }
    },
    "zoneName": "Zone 1"
  }],
  "backupEnabled": false,
  "providerBackupEnabled" : true,
  "autoScaling": {
    "diskGBEnabled": true
  }
}

The command prints the following to the terminal. To learn more about these fields, see Output.

{
 "autoScaling": {
  "diskGBEnabled": true
 },
 "backupEnabled": false,
 "biConnector": {
  "enabled": false,
  "readPreference": "secondary"
 },
 "clusterType": "REPLICASET",
 "diskSizeGB": 100,
 "encryptionAtRestProvider": "NONE",
 "id": "5e6165b47cb26270c310bfd5",
 "groupId": "5e2f04ecf10fab66c7d4072e",
 "mongoDBVersion": "4.0.16",
 "mongoDBMajorVersion": "4.0",
 "mongoURIUpdated": "2020-03-05T20:48:52Z",
 "name": "myCluster",
 "numShards": 1,
 "paused": false,
 "providerBackupEnabled": true,
 "providerSettings": {
  "diskIOPS": 300,
  "encryptEBSVolume": true,
  "instanceSizeName": "M40",
  "providerName": "AWS",
  "regionName": "US_EAST_1",
  "volumeType": "STANDARD"
 },
 "replicationFactor": 3,
 "replicationSpec": {
  "US_EAST_1": {
   "analyticsNodes": 0,
   "electableNodes": 3,
   "priority": 7,
   "readOnlyNodes": 0
  }
 },
 "replicationSpecs": [
  {
   "id": "5e6165b47cb26270c310bfcf",
   "numShards": 1,
   "zoneName": "Zone 1",
   "regionsConfig": {
    "US_EAST_1": {
     "analyticsNodes": 0,
     "electableNodes": 3,
     "priority": 7,
     "readOnlyNodes": 0
    }
   }
  }
 ],
 "stateName": "CREATING"
}