OCI POSTGRESQL → STACKIT POSTGRESQL FLEX · TUTORIAL

OCI Database with PostgreSQL to PostgreSQL Flex

A managed PostgreSQL system on Oracle Cloud becomes a PostgreSQL Flex instance on STACKIT, and the data moves with a dump and restore or with logical replication. StackToIT reads the oci_psql_db_system block, classifies it as REPLATFORM, names the three STACKIT objects it becomes and lists the 19 settings your team carries across by hand. This walk-through takes a small demo estate from input to a reviewed plan.

Step 1: the input and what StackToIT records for it

A four-resource Oracle Cloud estate written for this page and assessed by StackToIT on 4 November 2026: a VCN, a subnet, a network security group and one PostgreSQL system of two nodes. Left: the database block of the input, unchanged. Right: the decision recorded for it in assessment.json. assessment.json is written as a single line, so the pane shows selected fields of each unit, indented and nested as in the file, with the values unchanged.

Example inputmain.tf
resource "oci_psql_db_system" "orders" {
  compartment_id              = var.compartment_id
  display_name                = "orders-db"
  db_version                  = "16"
  shape                       = "VM.Standard.E4.Flex"
  instance_count              = 2
  instance_ocpu_count         = 4
  instance_memory_size_in_gbs = 64

  network_details {
    subnet_id = oci_core_subnet.data.id
    nsg_ids   = [oci_core_network_security_group.db.id]
  }

  storage_details {
    is_regionally_durable = true
    system_type           = "OCI_OPTIMIZED_STORAGE"
    iops                  = 75000
  }

  credentials {
    username = "orders_admin"
    password_details {
      password_type  = "VAULT_SECRET"
      secret_id      = var.db_secret_id
      secret_version = "1"
    }
  }

  management_policy {
    maintenance_window_start = "sun 02:00"
    backup_policy {
      kind           = "DAILY"
      backup_start   = "01:00"
      retention_days = 35
    }
    pitr_policy {
      kind         = "STANDARD"
      restore_days = 7
    }
  }
}
StackToIT assessmentassessment.json
{
  "id": "oci_psql_db_system.orders",
  "result": {
    "class": "REPLATFORM",
    "confidence": "MEDIUM",
    "target": {
      "service": "STACKIT PostgreSQL Flex",
      "resources": [
        "stackit_postgresflex_instance",
        "stackit_postgresflex_database",
        "stackit_postgresflex_user"
      ]
    },
    "reason": "Managed PostgreSQL to managed PostgreSQL: data moves with pg_dump/pg_restore or logical replication, and the shape becomes a Flex flavor."
  }
}
  • REPLATFORM, medium confidence

    Managed PostgreSQL goes to managed PostgreSQL, so the platform model changes while the engine stays. The run caps confidence at medium because the oci provider has no lock file entry: the version a plan would use is not proven. Commit .terraform.lock.hcl next to the root module and the cap goes away.

  • Three STACKIT objects

    The target is STACKIT PostgreSQL Flex, written as stackit_postgresflex_instance, stackit_postgresflex_database and stackit_postgresflex_user. The run lists PostgreSQL Flex in the STACKIT catalogue snapshot for both eu01 and eu02.

  • Nothing is drafted for you

    The Terraform folder of this run holds only provider and variable files. For an Oracle Cloud source every unit, this database included, is left to your architects, and the manual steps for it sit in execution/manual/actions.md.

  • 19 settings named

    engineering/architect-report.md counts them for this unit and names the first five; assessment.json lists all 19: compartment_id, credentials, db_version, display_name, instance_count, instance_memory_size_in_gbs, instance_ocpu_count, shape, the network subnet and security groups, the storage settings and six management_policy settings for backups, point-in-time recovery and the maintenance window.

Step 2: the order the run proposes

The command, run from inside the demo's input folder, writes the result to the output folder next to it, with the options the run for this page used. With OpenTofu on the PATH, the provider packages in a local mirror and a .terraform.lock.hcl in the source, you can leave out --no-validate and let the run also validate the source with OpenTofu. The sequencing file puts the units in waves from their dependencies.

Command used for this pageshell
# run from inside the demo's input folder; the output folder sits next to it
stacktoit assess . ../out --offline --no-validate
StackToIT resultmigration/technical-sequencing.md
## Wave 1 — 1 unit(s)

| Unit | Class | Target |
|---|---|---|
| `oci_core_vcn.main` | RECONFIGURE / MEDIUM | STACKIT network |

## Wave 2 — 2 unit(s)

| Unit | Class | Target |
|---|---|---|
| `oci_core_network_security_group.db` | RECONFIGURE / MEDIUM | STACKIT security groups |
| `oci_core_subnet.data` | RECONFIGURE / MEDIUM | STACKIT network |

## Wave 3 — 1 unit(s)

| Unit | Class | Target |
|---|---|---|
| `oci_psql_db_system.orders` | REPLATFORM / MEDIUM | STACKIT PostgreSQL Flex |
  • Network before data

    The database sits in wave 3 because it depends on the subnet and the security group, which depend on the VCN. Your STACKIT network and security group must exist before the instance can be reached.

  • The data decision stays open

    migration/data-movement.md lists the system as a stateful unit with the mechanism UNKNOWN and the state DECISION_REQUIRED. The size of the data, its change rate and the downtime your business tolerates are not in the Terraform, so the run does not guess them.

Step 3: what to change before you apply

Each row takes one setting of the demo input and says what STACKIT asks for in its place. Values on the STACKIT side come from the STACKIT documentation and the STACKIT Terraform provider 0.121.0; check them again on the day you build.

Setting in the OCI inputOn STACKITWhat you decide
db_version = "16"version is required; PostgreSQL 14, 15, 16, 17 and 18 are listed as supportedStart with the highest version your client applications support. As a general rule, a dump from an older server loads into a newer one.
shape VM.Standard.E4.Flex, 4 OCPUs, 64 GBflavor_id such as 4.32 (4 CPUs, 32 GB) or 16.128 (16 CPUs, 128 GB); CPU and RAM are per nodeNo listed flavor has 64 GB. Size from the workload, not from the OCI numbers; the flavor can be changed later, with a downtime.
instance_count = 2A single instance has one node, a replica set three. In provider 0.121.0 the flavor_id selects the type (the provider example uses 4.8-replica); the older replicas attribute (1 or 3) is deprecatedTwo nodes do not exist on STACKIT. Choose one node, or three for production resilience.
storage iops = 75000, OCI_OPTIMIZED_STORAGEA performance class from premium-perf2-stackit to premium-perf12-stackit; the highest lists 20,000 IOPS and 350 MB/sThe class cannot be changed after creation. If the OCI system really runs above 20,000 IOPS, plan the workload, not only the copy.
management_policy backup DAILY 01:00, retention_days = 35backup_schedule as a cron expression such as 0 1 * * * (UTC), retention_days between 32 and 90Daily is the only schedule STACKIT offers. 35 days fits the allowed range.
pitr_policy STANDARD, restore_days = 7The transaction log is on by default; restore to any point covered by the available backupsRestore creates a clone in the same project. There is no in-place restore, so clients are pointed at the clone.
network_details: subnet and security groupnetwork.acl, a list of IPv4 addresses and ranges; by default only predefined STACKIT address ranges reach the instanceRewrite the security group rules as ACL entries for the networks that connect.
credentials with a vault secretstackit_postgresflex_user, one per database loginCreate the user on STACKIT and keep its credentials in the secret store you will use after the move.

Maintenance window: the demo sets sun 02:00. The STACKIT pages used here do not state how a window is set, so confirm it in the PostgreSQL Flex documentation instead of assuming an equivalent.

Step 4: move the data

StackToIT never moves data. These steps are general practice for a PostgreSQL to PostgreSQL move; the engine names the two mechanisms in its reason and leaves the choice to you.

  1. Create the target first

    Apply your reviewed instance, database and user on STACKIT. Check that the extensions your application uses are among the 33 listed for PostgreSQL Flex, for example pgvector, postgis or pg_trgm.

  2. Choose dump or replication

    For a database that tolerates a maintenance window, a dump is the simple path: for example pg_dump -Fd -j 4 on the source and pg_restore -j 4 on the target. If the window is short, plan logical replication instead, and confirm on STACKIT that the instance accepts it before you rely on it; this page does not claim that.

  3. Rehearse and time it

    Restore into a throwaway instance and measure the duration with your real data volume. The run cannot, because the size of the data is not in the source.

  4. Cut over

    Stop writes on the source, take the final dump or let replication drain, restore, run your validation queries and point the application at the new host and port. Keep the OCI system untouched until the checks pass; that is your rollback.

  5. Set up backups and an owner

    Confirm the first daily backup on STACKIT exists, and test a clone once. Create the database users your applications need, one per login, and hand the credentials to their owners through your secret store.

Decisions your architects own

  • One node or three

    Availability on STACKIT is a choice of instance type made at creation, not an OCI node count carried over.

  • Flavor and performance class

    The performance class is fixed after creation, so size it with headroom. Storage size can be increased later.

  • Dump or replication

    The trade is downtime against moving parts. The data-movement file stays open until you record the choice.

  • Network exposure

    Which address ranges may reach the database. Decide this on purpose and write it as ACL entries; the default is the predefined STACKIT ranges only.

  • Backup retention

    32 to 90 days on STACKIT. Pick a number that matches your recovery requirement.

  • Who owns the secrets

    Decide where database credentials live before the first user is created.

Proven on a real AWS estate

The AWS Retail Store Sample App, a public Terraform project from AWS, assessed by StackToIT and published in full, exactly as the run wrote it.

View Case Study
282
Terraform resource declarations analyzed
44
migration units identified
38
target units generated, from 52 considered
331
plan steps written

Questions database teams ask

Does the OCI PostgreSQL version have to match the STACKIT version?

No. STACKIT lists PostgreSQL 14 to 18. As a general rule, a dump taken from an older server loads into a newer one, while pg_dump does not promise that a dump loads into an older server. Test the application on the target version before the cutover.

Can StackToIT create the PostgreSQL Flex instance for us?

Not for an Oracle Cloud source in this run. The run classifies the database and names the target resources, and leaves the Terraform for it to your architects. Nothing is created in any cloud.

What happens to point-in-time recovery after the move?

The transaction log is on by default on STACKIT, and you can restore to a point covered by your backups. A restore produces a new instance in the same project; there is no in-place restore.

How do we know the plan covers the whole database?

Go through the 19 settings that assessment.json lists for the unit; engineering/architect-report.md gives their count and the first five. Each is a line your team resolves on purpose: carried over, replaced by a STACKIT setting, or recorded as not needed.

Sources

Your next move: STACKIT.

Tell us about your estate. We show you what StackToIT delivers for it: target architecture, Terraform artifacts and a structured migration plan.