Create and manage instances
Prerequisites
Section titled “Prerequisites”- You have a STACKIT customer account: Create a customer account
- You have a STACKIT user account: Create a user account
- You have a STACKIT project: Create a project
Instance properties
Section titled “Instance properties”Independent of the method you choose to create and manage an instance, there are common properties of a MongoDB Flex instance.
Instance type
Section titled “Instance type”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 case | Instance type |
|---|---|
| Development | Single (1 node) |
| Production (Normal) | Replica Set (3 nodes) |
| Production (High Performance) | Sharded cluster (9 nodes) |
Flavor
Section titled “Flavor”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.
Performance class / storage class
Section titled “Performance class / storage class”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.
Disk size
Section titled “Disk size”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.
MongoDB version
Section titled “MongoDB version”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.
Create an instance
Section titled “Create an instance”To create an instance, you first need to login to the STACKIT Portal.
Choose the flavor and storage class
Section titled “Choose the flavor and storage class”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:
stackit mongodbflex options --storages --flavor-id 4.32Choose the properties for your new instance
Section titled “Choose the properties for your new instance”| Flag | Options | Default | Optional |
|---|---|---|---|
| name | my-mongodb-flex-instance | ||
| type | Single, Replica, Sharded | Replica | x |
| flavor-id | See Flavors and performance classes of MongoDB Flex | ||
| storage-class | See Flavors and performance classes of MongoDB Flex | premium-perf2-mongodb | x |
| storage-size | Integer | 10 | x |
| version | 7.0, 8.0 | 8.0 | x |
| acl | IPv4 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.
Execute the creation command
Section titled “Execute the creation command”To create your instance, execute the following command:
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-464ee5a9fbedExamples
Section titled “Examples”Create an instance with minimum flags:
stackit mongodbflex instance create --name my-mongodb-instance --acl 193.148.160.0/19 --flavor-id 4.32Create an instance with multiple entries in the ACL table:
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-
On the sidebar, click on MongoDB Flex.
-
On the bar on the top, click on Create MongoDB flex.
See Instance properties for a better understanding of all options.
-
After you configured everything to your needs, create your instance.
For cost control, you can see a price estimation on the right hand site. To create the instance, click on Order fee-based. The system will add your newly created instance to the list of your MongoDB flex instances. After a few seconds, your instance state changes from Processing to Active. Congratulations, your MongoDB Flex instance is up and running!
View an instance
Section titled “View an instance”To view an instance, execute with the following parameters:
| Argument | Description |
|---|---|
| INSTANCE_ID | Instance ID of the instance you want to query |
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 * * *- On the sidebar, click on MongoDB Flex.
- Click on the instance you’d like to view.
Edit an instance
Section titled “Edit an instance”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.
| Argument | Description |
|---|---|
| INSTANCE_ID | Instance ID of the instance you want to query |
| Flags | Datatype | Unit |
|---|---|---|
| acl | Array of strings | |
| backup-schedule | String | |
| CPU | Integer | Virtual core |
| flavor-id | String | - |
| name | String | - |
| ram | Integer | Gigabyte |
| storage-class | String | - |
| storage-size | Integer | Gigabyte |
| type | String | - |
| version | String | - |
To edit the instance, execute the following command:
stackit mongodbflex instance update <INSTANCE_ID> --<Flag Name> <Flag Value>Example
Section titled “Example”stackit mongodbflex instance update 8db6a0f2-2b93-43f3-be54-464ee5a9fbed --flavor-id 2.16To edit the performance class, the disk size, the MongoDB version and ACLs:
-
On the sidebar, click on MongoDB Flex.
-
Click on the instance you’d like to edit.
-
Next to General information, click on Edit.
-
Make the changes according to your needs and click on Save.
-
Wait for the database to become Active again.
To change the flavor:
- On the sidebar, click on MongoDB Flex.
- Click on the instance you’d like to edit.
- On the sidebar, click on Flavor.
- On the desired flavor pane, click on Change.
- Confirm the price and click on Order fee-based.
- Wait for the database to become Active again.
To change the backup schedule:
- On the sidebar, click on MongoDB Flex.
- Click on the instance you’d like to edit.
- On the sidebar, click on Backups.
- On the top right pane, click on Schedule.
- Make the desired changes and click on Save.
Delete an instance
Section titled “Delete an instance”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:
| Argument | Description |
|---|---|
| INSTANCE_ID | Instance ID of the instance you want to query |
stackit mongodbflex instance delete <INSTANCE_ID>You get the following output:
Deleted instance "my-mongodb-instance"You can delete an instance when it operates in its Active state. You cannot undo a deletion.
- On the sidebar, click on MongoDB Flex.
- On the pane of the instance you want to delete, click on the three dots icon.
- Click on Delete.
- Enter the name of the instance and confirm with Delete.