Skip to content

Create and manage instances

Independent of the method you choose to create and manage an instance, there are common properties of a MongoDB Flex instance.

With the instance type, you can determine vertical and horizontal scaling. Horizontal scaling increases availability, while vertical scaling increases performance. The single instance type doesn’t have horizontal or vertical scaling. A replica set offers horizontal scaling and thus achieves high availability. A sharded cluster combines horizontal and vertical scaling.

Use caseInstance type
DevelopmentSingle (1 node)
Production (Normal)Replica Set (3 nodes)
Production (High Performance)Sharded cluster (9 nodes)

Select the flavor which fits your workload. It is safe to start with a smaller flavor and change to a bigger one afterwards. Depending on the instance type you chose, some flavors are not available. You can choose flavors from Tiny to X-Large, whereas every size has its CPU, memory or database optimized version. For a detailled reference of available flavors, read Flavors and performance classes of MongoDB Flex.

With the performance class, you determine the properties of the underlying storage. This setting is completely independent from the flavor. The latter only affects CPU and RAM. For Replica- and Sharded-Instances, you can safely start with the smallest available performance class, because you can change it anytime. For Single-Instances, you can not change the performance class afterwards. For a detailled reference of available performance classes, read Flavors and performance classes of MongoDB Flex.

With the disk size, you determine the initial size of the underlying storage. The default setting is 10GB. You can safely apply this size and enlarge the disk afterwards.

With the MongoDB version select, you set which MongoDB version comes to play. STACKIT updates the MongoDB major version according to the releases of MongoDB with a reasonable delay for implementing it. Read the Release notes for deprecation notices and announcements of new versions regularly. For safety reasons, STACKIT will deprecate MongoDB versions, when they reach their EOL status. Furthermore, STACKIT applies minor updates for security reasons.

With the ACL entries, you control which source IPs are allowed to connect to your instance. This is an additional security layer and does not replace the need for proper authentication and security best practice. There are two predefined entries: 193.148.160.0/19 and 45.129.40.0/21. They ensure that you can access your instance from STACKIT cloud services. If you want to access your instance from the public net, you need to add the client’s IPv4 address or subnet. The entries follow the CIDR notation. If you want to allow a single IP address (e.g. single host), then set 32as the subnet parameter. E.g. to allow a host with the source IPv4 address of 93.229.84.137, add 93.229.84.137/32 as ACL entry. At the moment, you can’t add IPv6 addresses.

To create an instance, you first need to login to the STACKIT Portal.

First, you need to determine which flavor and storage class you need. The available storage classes depend on the chosen flavor. To get a list of available flavors, execute stackit mongodbflex options --flavors. Then you can get a list of available storage classes with stackit mongodbflex options --storages --flavor-id <flavor-id>. To get the available storage classes for the flavor 4.32, execute:

Terminal window
stackit mongodbflex options --storages --flavor-id 4.32

Choose the properties for your new instance

Section titled “Choose the properties for your new instance”
FlagOptionsDefaultOptional
namemy-mongodb-flex-instance
typeSingle, Replica, ShardedReplicax
flavor-idSee Flavors and performance classes of MongoDB Flex
storage-classSee Flavors and performance classes of MongoDB Flexpremium-perf2-mongodbx
storage-sizeInteger10x
version7.0, 8.08.0x
aclIPv4 and net in CIDR notation

You can also have a look at Flavors and performance classes of MongoDB Flex, to learn more about the available flavors and performance classes.

To create your instance, execute the following command:

Terminal window
stackit mongodbflex instance create --name <name> --type <type> --flavor-id <flavor> --storage-class <storage-class> --storage-size <storage size> --version <version --acl <acl>

After executing the command, you need to confirm with y.

When the instance is created succesfully, the CLI will return the instance ID:

Created instance for project "My-MongoDB-Project". Instance ID: 8db6a0f2-2b93-43f3-be54-464ee5a9fbed

Create an instance with minimum flags:

Terminal window
stackit mongodbflex instance create --name my-mongodb-instance --acl 193.148.160.0/19 --flavor-id 4.32

Create an instance with multiple entries in the ACL table:

Terminal window
stackit mongodbflex instance create --name my-mongodb-instance --acl 193.148.160.0/19,45.129.40.0/21,93.229.84.137/32 --flavor-id 4.32

To view an instance, execute with the following parameters:

ArgumentDescription
INSTANCE_IDInstance ID of the instance you want to query
Terminal window
stackit mongodbflex instance describe <INSTANCE_ID>

Example output:

ID │ 8db6a0f2-2b93-43f3-be54-464ee5a9fbed
───────────────────────┼──────────────────────────────────────
NAME │ my-mongodb-instance
───────────────────────┼──────────────────────────────────────
STATUS │ READY
───────────────────────┼──────────────────────────────────────
STORAGE SIZE (GB) │ 10
───────────────────────┼──────────────────────────────────────
VERSION │ 8.0
───────────────────────┼──────────────────────────────────────
ACL │ 93.229.84.137/32,93.229.85.0/24
───────────────────────┼──────────────────────────────────────
FLAVOR DESCRIPTION │ Medium, Memory optimized
───────────────────────┼──────────────────────────────────────
TYPE │ Replica
───────────────────────┼──────────────────────────────────────
REPLICAS │ 3
───────────────────────┼──────────────────────────────────────
CPU │ 4
───────────────────────┼──────────────────────────────────────
RAM (GB) │ 32
───────────────────────┼──────────────────────────────────────
BACKUP SCHEDULE (UTC) │ 0 0/6 * * *

You can edit the following properties of an instance: acl, backup-schedule, CPU, flavor-id, name, ram, storage-class, storage-size, type and version. To get a reference to these flags, have a look at Create an instance.

To get a deeper understanding on the backup schedule, read Backup, restore, and clone MongoDB Flex.

ArgumentDescription
INSTANCE_IDInstance ID of the instance you want to query
FlagsDatatypeUnit
aclArray of strings
backup-scheduleString
CPUIntegerVirtual core
flavor-idString-
nameString-
ramIntegerGigabyte
storage-classString-
storage-sizeIntegerGigabyte
typeString-
versionString-

To edit the instance, execute the following command:

Terminal window
stackit mongodbflex instance update <INSTANCE_ID> --<Flag Name> <Flag Value>
Terminal window
stackit mongodbflex instance update 8db6a0f2-2b93-43f3-be54-464ee5a9fbed --flavor-id 2.16

You can delete an instance when it operates in its READY-state. After executing this command, the operation cannot be undone. To delete an instance, execute:

ArgumentDescription
INSTANCE_IDInstance ID of the instance you want to query
Terminal window
stackit mongodbflex instance delete <INSTANCE_ID>

You get the following output:

Deleted instance "my-mongodb-instance"