Migrate from Cloud SQL for PostgreSQL to AlloyDB for PostgreSQL

This document describes how to migrate a Cloud SQL for PostgreSQL instance by copying a Cloud SQL backup into an AlloyDB for PostgreSQL free trial cluster. This feature lets you to evaluate AlloyDB by quickly loading data.

The following aren't supported:

  • Cross-project and cross-region restores
  • Instances with Customer Managed Encryption Keys (CMEK)
  • Instances with Identity and Access Management (IAM) group authentication

This document is intended for database administrators and data engineers who are using Cloud SQL. If you're new to AlloyDB, see the AlloyDB overview.

To learn how to migrate your data from Cloud SQL to AlloyDB using continuous data replication, see Database Migration Service for PostgreSQL to AlloyDB.

Before you begin

To complete the tasks in this document, make sure that you have the following:

Required roles

To get the permissions that you need to copy a Cloud SQL for PostgreSQL backup into an AlloyDB cluster, ask your administrator to grant you the following IAM roles on your project:

Copy a Cloud SQL backup into an AlloyDB cluster

Copying a Cloud SQL backup into an AlloyDB free trial cluster restores the backup to the same version of PostgreSQL on AlloyDB, for example, Postgres 14 restores to Postgres 14. Keep in mind that extension versions and PostgreSQL minor versions might be different.

Restoring from Cloud SQL only supports the configuration of those items supported in the AlloyDB for PostgreSQL free trial cluster.

To copy a Cloud SQL backup into an AlloyDB cluster, follow these steps:

  1. In the Google Cloud console, go to the Clusters page.

    Go to Clusters

  2. Click Start a free trial.

  3. Click Copy from Cloud SQL backup.

  4. In the Copy from Cloud SQL backup page, enable the required APIs. If you already enabled the APIs, you don't need to re-enable the APIs.

  5. Select the Cloud SQL instance that you want to restore from and then click Select instance. You can filter Cloud SQL instances.

    Only compatible database versions are displayed. Replicas don't have backups and aren't displayed in the list of available instances.

  6. Select the backup you want to import from and then click Select backup. This page displays the most recent 1,000 backups.

  7. In the Create your free cluster page, enter the cluster ID and your networking information.

  8. Click Create Free Cluster. After the operation completes, a primary instance is automatically created. You see a new AlloyDB cluster with the data that is copied from the Cloud SQL for PostgreSQL backup that you selected.

    When you copy a Cloud SQL for PostgreSQL backup into an AlloyDB cluster, database flags and resource level permissions aren't automatically migrated. After the copy is complete, you must set up these flags and permissions manually.

What's next