gcloud sql instances clone - clones a Cloud SQL instance
gcloud sql instances clone SOURCE DESTINATION [--async] [--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 ...]
gcloud sql instances clone 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.
To clone an instance from its current state (most recent binary log coordinates):
$ gcloud sql instances clone instance-foo instance-bar
To clone a MySQL instance from an earlier point in time (past binary log coordinates):
$ gcloud sql instances clone instance-foo instance-bar \ --bin-log-file-name mysql-bin.000020 --bin-log-position 170
To clone a MySQL source instance at a specific point in time:
$ gcloud sql instances clone instance-foo instance-bar \ --point-in-time '2012-11-15T16:19:00.094Z'
To clone a PostgreSQL source instance at a specific point in time:
$ gcloud sql instances clone instance-foo instance-bar \ --point-in-time '2012-11-15T16:19:00.094Z'
To clone a SQL Server source instance at a specific point in time:
$ gcloud sql instances clone instance-foo instance-bar \ --point-in-time '2012-11-15T16:19:00.094Z'
- SOURCE
Cloud SQL instance ID of the source.
- DESTINATION
Cloud SQL instance ID of the clone.
- --async
Return immediately, without waiting for the operation in progress to complete.
- 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 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.
- --bin-log-position=BIN_LOG_POSITION
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.
- --point-in-time=POINT_IN_TIME
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.
- --restore-database-name=RESTORE_DATABASE_NAME
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.
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.
These variants are also available:
$ gcloud alpha sql instances clone
$ gcloud beta sql instances clone