File: //snap/google-cloud-cli/396/help/man/man1/gcloud_alpha_sql_instances_clone.1
.TH "GCLOUD_ALPHA_SQL_INSTANCES_CLONE" 1
.SH "NAME"
.HP
gcloud alpha sql instances clone \- clones a Cloud SQL instance
.SH "SYNOPSIS"
.HP
\f5gcloud alpha sql instances clone\fR \fISOURCE\fR \fIDESTINATION\fR [\fB\-\-allocated\-ip\-range\-name\fR=\fIALLOCATED_IP_RANGE_NAME\fR] [\fB\-\-async\fR] [\fB\-\-preferred\-secondary\-zone\fR=\fIPREFERRED_SECONDARY_ZONE\fR] [\fB\-\-preferred\-zone\fR=\fIPREFERRED_ZONE\fR] [\fB\-\-source\-instance\-deletion\-time\fR=\fISOURCE_INSTANCE_DELETION_TIME\fR] [\fB\-\-bin\-log\-file\-name\fR=\fIBIN_LOG_FILE_NAME\fR\ \fB\-\-bin\-log\-position\fR=\fIBIN_LOG_POSITION\fR\ |\ [\fB\-\-point\-in\-time\fR=\fIPOINT_IN_TIME\fR\ :\ \fB\-\-restore\-database\-name\fR=\fIRESTORE_DATABASE_NAME\fR]] [\fIGCLOUD_WIDE_FLAG\ ...\fR]
.SH "DESCRIPTION"
\fB(ALPHA)\fR \fBgcloud alpha sql instances clone\fR creates a clone of a Cloud
SQL instance. The clone is an independent copy of the source instance with the
same data and settings. Source and destination instances must be in the same
project. An instance can be cloned from its current state, or from an earlier
point in time.
For MySQL: The binary log coordinates or timestamp (point in time), if
specified, act as the point in time the source instance is cloned from. If not
specified, the current state of the instance is cloned.
For PostgreSQL: The point in time, if specified, defines a past state of the
instance to clone. If not specified, the current state of the instance is
cloned.
For SQL Server: The point in time, if specified, defines a past state of the
instance to clone. If not specified, the current state of the instance is
cloned.
.SH "EXAMPLES"
To clone an instance from its current state (most recent binary log
coordinates):
.RS 2m
$ gcloud alpha sql instances clone my\-source\-instance \e
my\-cloned\-instance
.RE
To clone a MySQL instance from an earlier point in time (past binary log
coordinates):
.RS 2m
$ gcloud alpha sql instances clone my\-source\-instance \e
my\-cloned\-instance \-\-bin\-log\-file\-name mysql\-bin.000020 \e
\-\-bin\-log\-position 170
.RE
To clone a MySQL source instance at a specific point in time:
.RS 2m
$ gcloud alpha sql instances clone my\-source\-instance \e
my\-cloned\-instance \-\-point\-in\-time '2012\-11\-15T16:19:00.094Z'
.RE
To clone a PostgreSQL source instance at a specific point in time:
.RS 2m
$ gcloud alpha sql instances clone my\-source\-instance \e
my\-cloned\-instance \-\-point\-in\-time '2012\-11\-15T16:19:00.094Z'
.RE
To clone a SQL Server source instance at a specific point in time:
.RS 2m
$ gcloud alpha sql instances clone my\-source\-instance \e
my\-cloned\-instance \-\-point\-in\-time '2012\-11\-15T16:19:00.094Z'
.RE
To clone a deleted instance, include the name and deletion time of the source
instance:
.RS 2m
$ gcloud alpha sql instances clone my\-source\-instance \e
my\-cloned\-instance \e
\-\-source\-instance\-deletion\-time '2012\-11\-15T16:19:00.094Z'
.RE
To specify the allocated IP range for the private IP target Instance (reserved
for future use):
.RS 2m
$ gcloud alpha sql instances clone my\-source\-instance \e
my\-cloned\-instance \e
\-\-allocated\-ip\-range\-name cloned\-instance\-ip\-range
.RE
.SH "POSITIONAL ARGUMENTS"
.RS 2m
.TP 2m
\fISOURCE\fR
Cloud SQL instance ID of the source.
.TP 2m
\fIDESTINATION\fR
Cloud SQL instance ID of the clone.
.RE
.sp
.SH "FLAGS"
.RS 2m
.TP 2m
\fB\-\-allocated\-ip\-range\-name\fR=\fIALLOCATED_IP_RANGE_NAME\fR
The name of the IP range allocated for the destination instance with private
network connectivity. For example: 'google\-managed\-services\-default'. If set,
the destination instance IP is created in the allocated range represented by
this name. Reserved for future use.
.TP 2m
\fB\-\-async\fR
Return immediately, without waiting for the operation in progress to complete.
.TP 2m
\fB\-\-preferred\-secondary\-zone\fR=\fIPREFERRED_SECONDARY_ZONE\fR
The preferred secondary zone for the cloned regional instance. If you specify a
value for this flag, then the destination instance uses the value as the
secondary zone. The secondary zone can't be the same as the primary zone.
.TP 2m
\fB\-\-preferred\-zone\fR=\fIPREFERRED_ZONE\fR
The preferred zone for the cloned instance. If you specify a value for this
flag, then the destination instance uses the value as the primary zone.
.TP 2m
\fB\-\-source\-instance\-deletion\-time\fR=\fISOURCE_INSTANCE_DELETION_TIME\fR
The time the source instance was deleted. This is required if cloning from a
deleted instance.
.TP 2m
At most one of these can be specified:
.RS 2m
.TP 2m
Binary log coordinates for point\-in\-time recovery.
.RS 2m
.TP 2m
\fB\-\-bin\-log\-file\-name\fR=\fIBIN_LOG_FILE_NAME\fR
The name of the binary log file. Enable point\-in\-time recovery on the source
instance to create a binary log file. If specified with <\-\-bin\-log\-position>
to form a valid binary log coordinate, it defines an earlier 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 group
are specified.
.TP 2m
\fB\-\-bin\-log\-position\fR=\fIBIN_LOG_POSITION\fR
Represents the state of an instance at any given point in time inside a binary
log file. If specified along with <\-\-bin\-log\-file\-name> to form a valid
binary log coordinate, it defines an earlier point in time to clone a source
instance from. For example, 123 (a numeric value).
This flag argument must be specified if any of the other arguments in this group
are specified.
.RE
.sp
.TP 2m
\fB\-\-point\-in\-time\fR=\fIPOINT_IN_TIME\fR
Represents the state of an instance at any given point in time inside a
transaction log file. For MySQL, the binary log file is used for transaction
logs. For PostgreSQL, the write\-ahead log file is used for transaction logs.
For SQL Server, the log backup file is used for such purpose. To create a
transaction log, enable point\-in\-time recovery on the source instance.
Instance should have transaction logs accumulated up to the point in time they
want to restore up to. Uses RFC 3339 format in UTC timezone. If specified,
defines a past 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 group
are specified.
.TP 2m
\fB\-\-restore\-database\-name\fR=\fIRESTORE_DATABASE_NAME\fR
The name of the database to be restored for a point\-in\-time restore. If set,
the destination instance will only restore the specified database.
.RE
.RE
.sp
.SH "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 \fB$ gcloud help\fR for details.
.SH "NOTES"
This command is currently in alpha and might change without notice. If this
command fails with API permission errors despite specifying the correct project,
you might be trying to access an API with an invitation\-only early access
allowlist. These variants are also available:
.RS 2m
$ gcloud sql instances clone
.RE
.RS 2m
$ gcloud beta sql instances clone
.RE