Docs Menu

Docs HomeMongoDB Command Line Interface

mongocli atlas clusters create

On this page

  • Syntax
  • Arguments
  • Options
  • Inherited Options
  • Output
  • Examples

Create a cluster for your project.

To get started quickly, specify a name for your cluster, a cloud provider, and a region to deploy a three-member replica set with the latest MongoDB server version. For full control of your deployment, or to create multi-cloud clusters, provide a JSON configuration file with the --file flag.

To use this command, you must authenticate with a user account or an API key that has the Project Owner role.

Command Syntax
mongocli atlas clusters create [name] [options]
Name
Type
Required
Description
name
string
false
Name of the cluster. The cluster name cannot be changed after the cluster is created. Cluster name can contain ASCII letters, numbers, and hyphens. You must specify the cluster name argument if you don't use the --file option.
Name
Type
Required
Description
--backup
false
Flag that enables Continuous Cloud Backup for your deployment. This option is unavailable for clusters smaller than M10.
--biConnector
false

Flag that enables BI Connector for Atlas on the deployment.

Mutually exclusive with --file.

--diskSizeGB
float
false

Capacity, in gigabytes, of the host's root volume.

Mutually exclusive with --file. This value defaults to 2.

--enableTerminationProtection
false
Enables termination protection for your cluster. You can't delete a cluster with termination protection enabled.
-f, --file
string
false

Path to an optional JSON configuration file that defines cluster settings. To learn more about configuration files for the Atlas CLI, see https://www.mongodb.com/docs/atlas/cli/stable/cluster-config-file/. To learn more about configuration files for MongoCLI, see https://www.mongodb.com/docs/mongocli/stable/reference/mms-cluster-settings-file/.

Mutually exclusive with --tier, --provider, --members, --region, --diskSizeGB, --mdbVersion, --biConnector, --type, --shards, --tag.

-h, --help
false
help for create
--mdbVersion
string
false

Major MongoDB version of the cluster.

Mutually exclusive with --file.

-m, --members
int
false

Number of members in the replica set.

Mutually exclusive with --file. This value defaults to 3.

-o, --output
string
false
Output format. Valid values are json, json-path, go-template, or go-template-file. To see full output, use the -o json option.
--projectId
string
false
Hexadecimal string that identifies the project to use. This option overrides the settings in the configuration file or environment variable.
--provider
string
false

Name of your cloud service provider. Valid values are AWS, AZURE, or GCP. You must specify the provider option if you don't use the --file option.

Mutually exclusive with --file.

-r, --region
string
false

Physical location of your MongoDB cluster. You must specify the region option if you don't use the --file option. For a complete list of supported AWS regions, see: https://www.mongodb.com/docs/atlas/reference/amazon-aws/. For a complete list of supported Azure regions, see: https://www.mongodb.com/docs/atlas/reference/microsoft-azure/#microsoft-azure. For a complete list of supported GCP regions, see: https://www.mongodb.com/docs/atlas/reference/google-gcp/.

Mutually exclusive with --file.

-s, --shards
int
false

Number of shards in the cluster.

Mutually exclusive with --file. This value defaults to 1.

--tag
stringToString
false

List that contains key-value pairs between 1 to 255 characters in length for tagging and categorizing the cluster.

Mutually exclusive with --file. This value defaults to [].

--tier
string
false

Tier for each data-bearing server in the cluster. To learn more about cluster tiers, see https://www.mongodb.com/docs/atlas/manage-clusters/#select-cluster-tier.

Mutually exclusive with --file. This value defaults to "M2".

--type
string
false

Type of the cluster that you want to create. Valid values are REPLICASET or SHARDED.

Mutually exclusive with --file. This value defaults to "REPLICASET".

-w, --watch
false
Watch the command until it completes its execution or the watch times out. To set the time that the watch times out, use the --watchTimeout option.
--watchTimeout
uint
false
Time in seconds until a watch times out. After a watch times out, the CLI no longer watches the command.
Name
Type
Required
Description
-P, --profile
string
false

If the command succeeds, the CLI returns output similar to the following sample. Values in brackets represent your values.

Cluster '<Name>' created successfully.
# Deploy a free cluster named myCluster for the project with the ID 5e2211c17a3e5a48f5497de3:
mongocli atlas cluster create myCluster --projectId 5e2211c17a3e5a48f5497de3 --provider AWS --region US_EAST_1 --tier M0
# Deploy a free cluster named myCluster for the project with the ID 5e2211c17a3e5a48f5497de3 and tag "env=dev":
mongocli atlas cluster create myCluster --projectId 5e2211c17a3e5a48f5497de3 --provider AWS --region US_EAST_1 --tier M0 --tag env=dev
# Deploy a three-member replica set named myRS in AWS for the project with the ID 5e2211c17a3e5a48f5497de3:
mongocli atlas cluster create myRS --projectId 5e2211c17a3e5a48f5497de3 --provider AWS --region US_EAST_1 --members 3 --tier M10 --mdbVersion 5.0 --diskSizeGB 10
# Deploy a three-member replica set named myRS in AZURE for the project with the ID 5e2211c17a3e5a48f5497de3:
mongocli atlas cluster create myRS --projectId 5e2211c17a3e5a48f5497de3 --provider AZURE --region US_EAST_2 --members 3 --tier M10 --mdbVersion 5.0 --diskSizeGB 10
# Deploy a three-member replica set named myRS in GCP for the project with the ID 5e2211c17a3e5a48f5497de3:
mongocli atlas cluster create myRS --projectId 5e2211c17a3e5a48f5497de3 --provider GCP --region EASTERN_US --members 3 --tier M10 --mdbVersion 5.0 --diskSizeGB 10
# Deploy a cluster or a multi-cloud cluster from a JSON configuration file named myfile.json for the project with the ID 5e2211c17a3e5a48f5497de3:
mongocli atlas cluster create --projectId <projectId> --file myfile.json
←  mongocli atlas clusters connectionStrings describemongocli atlas clusters delete →
Share Feedback