CLOUD SQL → POSTGRESQL FLEX / MARIADB

Cloud SQL to STACKIT PostgreSQL Flex and MariaDB

Cloud SQL for PostgreSQL moves to STACKIT PostgreSQL Flex on the same major version, and Cloud SQL for MySQL moves to STACKIT MariaDB. StackToIT picks the flavor from the source tier, carries storage and authorized networks, and makes private access an explicit decision for your architect.

A private, regional PostgreSQL instance, converted

A small estate written for this page and assessed by StackToIT on 4 November 2026. Left: the input. Right: the resource blocks of the STACKIT Terraform the engine wrote; the review comments that sit above each block in the file are left out here.

Example inputmain.tf
resource "google_sql_database_instance" "orders" {
  name             = "orders-pg"
  region           = "europe-west3"
  database_version = "POSTGRES_16"
  depends_on       = [google_service_networking_connection.sql]

  settings {
    tier              = "db-custom-4-16384"
    availability_type = "REGIONAL"
    disk_size         = 200
    disk_type         = "PD_SSD"

    ip_configuration {
      ipv4_enabled    = false
      private_network = google_compute_network.data.id
    }

    backup_configuration {
      enabled                        = true
      start_time                     = "01:00"
      point_in_time_recovery_enabled = true
    }
  }
}

resource "google_sql_database" "orders" {
  name     = "orders"
  instance = google_sql_database_instance.orders.name
}
STACKIT Terraform by StackToITterraform/data.tf
resource "stackit_postgresflex_instance" "orders" {
  project_id = var.project_id
  name       = "orders-pg"
  version    = "16"
  flavor_id  = "4.32-replica"
  storage = {
    class = var.postgresflex_storage_class
    size  = 200
  }
  backup_schedule = "0 2 * * *"
  network = {
    acl = var.orders_allowed_cidrs
  }
  retention_days = 32
}

resource "stackit_postgresflex_database" "orders_orders" {
  project_id  = var.project_id
  instance_id = stackit_postgresflex_instance.orders.instance_id
  name        = "orders"
  owner       = var.orders_orders_owner
}
  • Flavor from the tier, HA kept

    db-custom-4-16384 has 4 vCPU and 16 GiB, and the instance is REGIONAL. The code picks 4.32-replica, the smallest replica flavor of PostgreSQL Flex in eu01 that covers it: three nodes that mirror each other.

  • Same major version, same storage

    PostgreSQL 16 stays 16, one of the versions 14 to 18 PostgreSQL Flex offers. The 200 GB disk carries over as the storage size; the performance class is yours to set.

  • Backups and point-in-time recovery

    Retention becomes 32 days, the lower end of the 32 to 90 days PostgreSQL Flex keeps. Point-in-time recovery restores into a new cloned instance, so the code says to update the recovery runbook.

  • The database comes along

    The orders database becomes a PostgreSQL Flex database in the new instance. Cloud SQL states no owner, so the code asks for the owning user.

A MySQL instance, converted to MariaDB

From the same run. Left: the input. Right: the resource blocks StackToIT wrote; the review comments above each block in the file are left out here.

Example inputmain.tf
resource "google_sql_database_instance" "catalog" {
  name             = "catalog-mysql"
  region           = "europe-west3"
  database_version = "MYSQL_8_0"

  settings {
    tier      = "db-custom-2-8192"
    disk_size = 50

    ip_configuration {
      ipv4_enabled = true

      authorized_networks {
        name  = "office"
        value = "203.0.113.0/24"
      }
    }

    backup_configuration {
      enabled            = true
      binary_log_enabled = true
      start_time         = "02:00"
    }
  }
}
STACKIT Terraform by StackToITterraform/data.tf
resource "stackit_mariadb_instance" "catalog" {
  project_id = var.project_id
  name       = "catalog-mysql"
  version    = var.catalog_version
  plan_name  = var.catalog_plan_name
  parameters = {
    sgw_acl = join(",", var.catalog_allowed_cidrs)
  }
}
  • MariaDB as the STACKIT target

    STACKIT offers MariaDB rather than MySQL. Data moves with a logical dump, and the code says to test MySQL 8 features against MariaDB before the cutover.

  • Authorized networks become the access list

    The office range 203.0.113.0/24 becomes the default of the access list variable. Add the egress addresses of the clients that run on STACKIT, or they cannot connect.

  • Plan and version chosen with the catalogue

    The plan variable lists the single-node and replica MariaDB plans of the eu01 catalogue next to the source tier, db-custom-2-8192, so you pick the plan and version in one place.

Private access is a decision

The PostgreSQL instance has no public IPv4 address and is reached through private services access. The run turns that into a decision rather than guessing.

  • Endpoint and access list

    A PostgreSQL Flex instance has its own host name and IPv4 address and is restricted by its access list. The variable for the allowed CIDRs has no default: list the STACKIT network prefixes of the clients.

  • Endpoint scope

    For a Cloud SQL instance with ipv4_enabled = false, the STACKIT endpoint scope is a decision for your architect. Left unset, the STACKIT API makes the endpoint public, so decide it for each such database before anything is applied.

  • Network Area scope

    PostgreSQL Flex can be scoped to a STACKIT Network Area, an opt-in for enabled accounts, for databases that must keep a private address.

  • No peering to rebuild

    The private services access connection and its reserved range need no STACKIT resource: managed services are reached on their own endpoints.

How the Cloud SQL estate maps

Google Cloud resourceSTACKIT targetMigration class
Cloud SQL for PostgreSQL with its databasePostgreSQL Flex instance and databaseReplatform
Cloud SQL for MySQLSTACKIT MariaDBReplatform
VPC networkSTACKIT project networking or Network AreaReconfigure
Reserved range for private services accessNot needed: managed services have their own endpointsReconfigure
Private services access connectionNot needed: endpoints restricted by access listsReconfigure

Classes as the run decided them. Backup start times are named in the code: the draft sets a daily backup at 02:00, and you set the time you want.

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 STACKIT offer MySQL?

STACKIT offers MariaDB. StackToIT maps Cloud SQL for MySQL to STACKIT MariaDB as REPLATFORM and asks you to test MySQL 8 features before the cutover.

How do we move the data?

PostgreSQL moves with pg_dump and pg_restore or with logical replication. MySQL data moves to MariaDB with a logical dump.

What happens to a regional, highly available instance?

StackToIT picks a replica flavor of PostgreSQL Flex, three nodes that mirror each other, sized so that it is not smaller than the source tier.

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.