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 PostgreSQL Flex instance.

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

Use caseInstance type
DevelopmentSingle (1 node)
Production (Normal)Replica set (3 nodes)

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

With the performance class, you determine the properties of the underlying storage. This setting is completely independent of the flavor. The latter only affects CPU and RAM. For a detailed reference of available performance classes, read Flavors and performance classes of PostgreSQL Flex.

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

With the PostgreSQL version select, you set which PostgreSQL version comes to play. STACKIT updates the PostgreSQL major version according to the releases of PostgreSQL, 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 PostgreSQL versions once they reach their EOL status. Furthermore, STACKIT applies minor updates for security reasons.

The system creates a daily snapshot of the database automatically. With this setting, you can control when this snapshot will be created. You can change it anytime.

With the ACL entries, you control which source IPs are allowed to connect to your instance. Note, that this is an additional security layer and does not replace the need for proper authentication and security best practices. 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 log into the STACKIT Portal.

First, 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 PostgreSQLflex options --flavors. Then you can get a list of available storage classes with stackit PostgreSQLflex options --storages --flavor-id <flavor-id>. To get the available storage classes for the flavor 4.32, execute:

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

Choose the properties for your new instance

Section titled “Choose the properties for your new instance”
FlagOptionsDefaultOptional
namemy-PostgreSQL-flex-instance
typeSingle, replica, shardedReplicax
flavor-idSee Flavors and performance classes of PostgreSQL Flex
storage-classSee Flavors and performance classes of PostgreSQL Flexpremium-perf2-PostgreSQLx
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 PostgreSQL Flex to learn more about the available flavors and performance classes.

To create your instance, execute the following command:

Terminal window
stackit PostgreSQLflex 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, confirm with y.

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

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

Create an instance with minimum flags:

Terminal window
stackit PostgreSQLflex instance create --name my-PostgreSQL-instance --acl 193.148.160.0/19 --flavor-id 4.32

Create an instance with multiple entries in the ACL table:

Terminal window
stackit PostgreSQLflex instance create --name my-PostgreSQL-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 PostgreSQLflex instance describe <INSTANCE_ID>

Example output:

ID │ 8db6a0f2-2b93-43f3-be54-464ee5a9fbed
───────────────────────┼──────────────────────────────────────
NAME │ my-PostgreSQL-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 PostgreSQL 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 PostgreSQLflex instance update <INSTANCE_ID> --<Flag Name> <Flag Value>
Terminal window
stackit PostgreSQLflex 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 PostgreSQLflex instance delete <INSTANCE_ID>

You get the following output:

Deleted instance "my-PostgreSQL-instance"