Cloning Instances

This page describes how to clone a Cloud SQL instance.

When you clone a Cloud SQL instance, you create a new instance that is a copy of the source instance, but completely independent. After the cloning operation is complete, changes to the source instance are not reflected in the clone, and vice versa.

The source instance configuration (activation policy, database flags, connectivity, and so on) is copied to the clone. Instance IP addresses and replicas are not copied; you must configure these items explicitly on the clone.

You cannot clone a replica. You can clone an instance that was cloned from another instance.

Cloning an instance

Console

  1. Go to the Cloud SQL Instances page in the Google Cloud Platform Console.

    Go to the Cloud SQL Instances page

  2. Find the instance you want to clone, and open its more actions menu at the far right of its listing.

    Image of three-dot menu

  3. Click Create clone.
  4. In the Create clone page, update the instance ID if needed, and click Create clone.

    You are returned to the instance listing page while the clone initializes.

gcloud

Clone the instance:

gcloud sql instances clone [SOURCE_INSTANCE_NAME] [TARGET_INSTANCE_NAME]

cURL

Clone the instance:

ACCESS_TOKEN="$(gcloud auth application-default print-access-token)"
curl --header "Authorization: Bearer ${ACCESS_TOKEN}" \
     --header 'Content-Type: application/json' \
     --data '{"cloneContext": {"destinationInstanceName": "[TARGET_INSTANCE_NAME]" }}' \
     -X POST \
     https://www.googleapis.com/sql/v1beta4/projects/[PROJECT-ID]/instances/[SOURCE_INSTANCE_NAME]/clone
Was this page helpful? Let us know how we did:

Send feedback about...

Cloud SQL for PostgreSQL