gcloud beta sql instances clone

NAME
gcloud beta sql instances clone - clones a Cloud SQL instance
SYNOPSIS
gcloud beta sql instances cloneSOURCEDESTINATION[--async][--destination-network=DESTINATION_NETWORK][--destination-project=DESTINATION_PROJECT][--preferred-secondary-zone=PREFERRED_SECONDARY_ZONE][--preferred-zone=PREFERRED_ZONE][--source-instance-deletion-time=SOURCE_INSTANCE_DELETION_TIME][--bin-log-file-name=BIN_LOG_FILE_NAME--bin-log-position=BIN_LOG_POSITION    | [--point-in-time=POINT_IN_TIME :--restore-database-name=RESTORE_DATABASE_NAME]][GCLOUD_WIDE_FLAG]
DESCRIPTION
(BETA)gcloud beta sql instances clone creates a cloneof a Cloud SQL instance. The clone is an independent copy of the source instancewith the same data and settings. Source and destination instances must be in thesame project. An instance can be cloned from its current state, or from anearlier point in time.

For MySQL: The binary log coordinates or timestamp (point in time), ifspecified, act as the point in time the source instance is cloned from. If notspecified, the current state of the instance is cloned.

For PostgreSQL: The point in time, if specified, defines a past state of theinstance to clone. If not specified, the current state of the instance iscloned.

For SQL Server: The point in time, if specified, defines a past state of theinstance to clone. If not specified, the current state of the instance iscloned.

Note: The flags --destination-project and --destination-network are currentlyfor allowlisted customers only.

EXAMPLES
To clone an instance from its current state (most recent binary logcoordinates):
gcloudbetasqlinstancesclonemy-source-instancemy-cloned-instance

To clone a MySQL instance from an earlier point in time (past binary logcoordinates):

gcloudbetasqlinstancesclonemy-source-instancemy-cloned-instance--bin-log-file-namemysql-bin.000020--bin-log-position170

To clone a MySQL source instance at a specific point in time:

gcloudbetasqlinstancesclonemy-source-instancemy-cloned-instance--point-in-time'2012-11-15T16:19:00.094Z'

To clone a PostgreSQL source instance at a specific point in time:

gcloudbetasqlinstancesclonemy-source-instancemy-cloned-instance--point-in-time'2012-11-15T16:19:00.094Z'

To clone a SQL Server source instance at a specific point in time:

gcloudbetasqlinstancesclonemy-source-instancemy-cloned-instance--point-in-time'2012-11-15T16:19:00.094Z'

To clone a deleted instance, include the name and deletion time of the sourceinstance:

gcloudbetasqlinstancesclonemy-source-instancemy-cloned-instance--source-instance-deletion-time'2012-11-15T16:19:00.094Z'
POSITIONAL ARGUMENTS
SOURCE
Cloud SQL instance ID of the source.
DESTINATION
Cloud SQL instance ID of the clone.
FLAGS
--async
Return immediately, without waiting for the operation in progress to complete.
--destination-network=DESTINATION_NETWORK
The fully qualified URI of the VPC network to which the cloned instance will beconnected via Private Services Access for private IP. For example:projects/my-network-project/global/networks/my-network. This fieldis required only for cross-project cloning.
--destination-project=DESTINATION_PROJECT
The project ID of the destination project where the cloned instance will becreated. To perform a cross-project clone, this field is required. If notspecified, the clone is created in the same project as the source instance.
--preferred-secondary-zone=PREFERRED_SECONDARY_ZONE
The preferred secondary zone for the cloned regional instance. If you specify avalue for this flag, then the destination instance uses the value as thesecondary zone. The secondary zone can't be the same as the primary zone.
--preferred-zone=PREFERRED_ZONE
The preferred zone for the cloned instance. If you specify a value for thisflag, then the destination instance uses the value as the primary zone.
--source-instance-deletion-time=SOURCE_INSTANCE_DELETION_TIME
The time the source instance was deleted. This is required if cloning from adeleted instance.
At most one of these can be specified:
Binary log coordinates for point-in-time recovery.
--bin-log-file-name=BIN_LOG_FILE_NAME
The name of the binary log file. Enable point-in-time recovery on the sourceinstance to create a binary log file. If specified with<--bin-log-position> to form a valid binary log coordinate, it defines anearlier point in time to clone a source instance from. For example,mysql-bin.000001.

This flag argument must be specified if any of the other arguments in this groupare specified.

--bin-log-position=BIN_LOG_POSITION
Represents the state of an instance at any given point in time inside a binarylog file. If specified along with <--bin-log-file-name> to form a validbinary log coordinate, it defines an earlier point in time to clone a sourceinstance from. For example, 123 (a numeric value).

This flag argument must be specified if any of the other arguments in this groupare specified.

--point-in-time=POINT_IN_TIME
Represents the state of an instance at any given point in time inside atransaction log file. For MySQL, the binary log file is used for transactionlogs. For PostgreSQL, the write-ahead log file is used for transaction logs. ForSQL Server, the log backup file is used for such purpose. To create atransaction log, enable point-in-time recovery on the source instance. Instanceshould have transaction logs accumulated up to the point in time they want torestore up to. Uses RFC 3339 format in UTC timezone. If specified, defines apast state of the instance to clone. For example, '2012-11-15T16:19:00.094Z'.

This flag argument must be specified if any of the other arguments in this groupare specified.

--restore-database-name=RESTORE_DATABASE_NAME
The name of the database to be restored for a point-in-time restore. If set, thedestination instance will only restore the specified database.
GCLOUD WIDE FLAGS
These flags are available to all commands:--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.

Run$gcloud help for details.

NOTES
This command is currently in beta and might change without notice. Thesevariants are also available:
gcloudsqlinstancesclone
gcloudalphasqlinstancesclone

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-10 UTC.