Navigation

mongocli atlas cluster create

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

Note

This feature is not available for M0 (Free Tier) clusters. For more information, see Atlas M0 (Free Tier) Limitations.

mongocli atlas cluster create <cluster-name>
[ --backup ]
[ --biConnector]
[ --diskSizeGB <size-of-disk> ]
[ --file|-f <path-to-cluster-config-file> ]
[ --mdbVersion <mongodb-version> ]
[ --members|-m <number-of-members> ]
[ --output|-o <output-format> ]
[ --profile|-P <profile-name> ]
[ --projectId <project-ID> ]
--provider AWS|GCP|AZURE
--region|-r <region-name>
[ --shards|-s <number-of-shards> ]
[ --tier <cluster-tier> ]
[ --type <replicaset-or-sharded>]
Note

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

Option
Type
Description
Required?
<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
--backup
boolean
Flag to enable backup on M10 and larger clusters. This option is unavailable for clusters smaller than M10. If omitted, cloud provider snapshots is disabled.
no
--biConnector
boolean
Flag to enable BI Connector on M10 and larger clusters. This option is unavailable for clusters smaller than M10.
no
--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:

Cluster Tiers
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
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.4
  • 4.2
  • 4.0 - for M10+ clusters only
  • 3.6 - for M10+ clusters only

By default, deploys v4.4.

no
--members, -m
integer
Number of members in the replica set. The default value is 3.
no
--output, -o
string

Command output format. Valid values are:

  • json for output in JSON format
  • go-template for custom output using the Go template
  • go-template-file for custom output specified using the Go template file

If omitted, the command returns output in the default format.

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. 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).

yes
--shards, -s
integer
Number of shards in the sharded cluster. The default value is 1, which is equivalent to a replica set.
no
--tier
string
Name of the cluster tier you want to use. You can later modify your cluster tier with the mongocli atlas cluster update command. If omitted, uses the tier M2.
no
--type
string

Type of cluster to deploy. Value can be:

  • REPLICASET to deploy a replica set, or
  • SHARDED to deploy a sharded cluster.

By default, deploys a replica set.

no

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

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

State of this cluster's disk auto-scaling:

  • true if enabled
  • false if disabled

By default, Atlas disables disk auto-scaling.

backupEnabled

State of cloud backup for this cluster:

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

State of BI Connector for the cluster:

  • true if enabled
  • false if disabled

The default value is false.

biConnector
.readPreference

Read preference for BI Connector on the cluster:

clusterType

Type of cluster:

  • REPLICASET
  • SHARDED
  • GEOSHARDED
diskSizeGB
Capacity, in GB, of the host's root volume.
encryptionAtRestProvider
Configuration for encryption at rest.
id
Unique identifier of the cluster.
groupId

Unique identifier of the project.

Note

Your project ID equals groupId.

labels
Returns identifying tags for the cluster. As of version 1.0.0, MongoDB uses this field to track use of monogcli.
mongoDBVersion
MongoDB version that is deployed.
mongoDBMajorVersion
Major version of MongoDB that is deployed.
mongoURI
Base connection string for the cluster.
MongoURIUpdated
Timestamp in Timestamp in ISO 8601 date and time format in UTC when someone last updated the connection string.
name
Name of the cluster.
numShards

Number of shards in the cluster:

  • 1: replica set.
  • Between 2 and 12 inclusive: sharded cluster.
paused

State of the cluster:

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

State of Cloud Backup for the cluster:

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

Cloud provider service on which the servers are provisioned:

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

Name of the cluster tier used for Atlas cluster:

Cluster Tiers
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
providerSettings
.providerName

Name of the cloud service provider on which Atlas provisioned the MongoDB host:

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

Physical location of the cluster.

For a complete list of regions, see cloud provider reference:

replicationFactor
Number of replica set members in the cluster: 3, 5, or 7.
replicationSpec
Configuration for each region in the cluster. Each element in this object represents a region where Atlas deployed your cluster.
replicationSpec
.<region>

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
Number of analytics nodes in the region.
replicationSpec
.<region>.electableNodes
Number of electable nodes in the region.
replicationSpec
.<region>.priority
Election priority of the region as an integer between 0 and 7 inclusive.
replicationSpec
.<region>.readOnlyNodes
Number of read-only nodes in the region.
replicationSpecs

Returns Global Cluster zone. As mongocli can't create Global Clusters, this response includes one zone only.

Each object in this array represents a zone where Atlas deploys nodes for your Global Cluster.

replicationSpecs.id
Unique identifier of the replication object.
replicationSpecs.numShards
Number of shards to deploy in the specified zone.
replicationSpecs.zoneName
Name for the zone.
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
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.
replicationSpecs[n]
.regionsConfig
.<regionName>.priority
Election priority of the region.
replicationSpecs[n]
.regionsConfig
.<regionName>.readOnlyNodes
Number of read-only nodes for Atlas to deploy to the region.
srvAddress
connection string for connecting to the Atlas cluster. The +srv modifier forces the connection to use TLS . The mongoURI parameter lists additional options.
stateName

Current status of the cluster:

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

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 default profile, 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 --tier M2 --mdbVersion 4.4 --diskSizeGB 10 --output json

The command returns 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": 10,
"encryptionAtRestProvider": "NONE",
"id": "5e272af4f10fab7c87718918",
"groupId": "5e2211c17a3e5a48f5497de3",
"labels": [
{
"key" : "Infrastructure Tool",
"value" : "mongoCLI"
}
],
"mongoDBVersion": "4.4",
"mongoDBMajorVersion": "4.4",
"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"
}

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 \
--output 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 returns 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",
"labels": [
{
"key" : "Infrastructure Tool",
"value" : "mongoCLI"
}
],
"mongoDBVersion": "4.4",
"mongoDBMajorVersion": "4.4",
"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"
}

The following mongocli atlas cluster create command creates a sample M10 sharded cluster named myShardedCluster in the GCP region EASTERN_US with 2 shards and 3 nodes per shard. The command uses the default profile, which contains the public and private keys for accessing Atlas, as well as a default project ID.

mongocli atlas cluster create myShardedCluster \
--provider GCP \
--region EASTERN_US \
--type SHARDED \
--shards 2 \
--members 3 \
--tier M10 \
--mdbVersion 4.4 \
--diskSizeGB 10 \
--output json

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

{
"autoScaling": {
"diskGBEnabled": true,
"compute": {
"enabled": false,
"scaleDownEnabled": false
}
},
"backupEnabled": false,
"biConnector": {
"enabled": false,
"readPreference": "secondary"
},
"clusterType": "SHARDED",
"diskSizeGB": 10,
"encryptionAtRestProvider": "NONE",
"labels": [
{
"key": "Infrastructure Tool",
"value": "mongoCLI"
}
],
"id": "5efe19b205e4b2501fb14374",
"groupId": "5dd6fab7493979f10faffb78",
"mongoDBVersion": "4.4",
"mongoDBMajorVersion": "4.4",
"mongoURIUpdated": "2020-07-02T17:30:25Z",
"name": "testShard",
"numShards": 2,
"paused": false,
"pitEnabled": false,
"providerBackupEnabled": false,
"providerSettings": {
"instanceSizeName": "M10",
"providerName": "GCP",
"regionName": "EASTERN_US",
"autoScaling": {
"compute": {}
}
},
"replicationFactor": 3,
"replicationSpec": {
"EASTERN_US": {
"analyticsNodes": 0,
"electableNodes": 3,
"priority": 7,
"readOnlyNodes": 0
}
},
"replicationSpecs": [
{
"id": "505e4b24efe19b1fb1437429",
"numShards": 2,
"zoneName": "Zone 1",
"regionsConfig": {
"EASTERN_US": {
"analyticsNodes": 0,
"electableNodes": 3,
"priority": 7,
"readOnlyNodes": 0
}
}
}
],
"stateName": "CREATING",
"connectionStrings": {}
}
Give Feedback