NAME

gcloud spanner backups create - creates a backup of a Cloud Spanner database

SYNOPSIS

gcloud spanner backups create (BACKUP : --instance=INSTANCE) --database=DATABASE (--expiration-date=EXPIRATION_DATE | --retention-period=RETENTION_PERIOD) [--async] [--version-time=TIMESTAMP] [--encryption-type=ENCRYPTION_TYPE [--kms-key=KMS_KEY : --kms-keyring=KMS_KEYRING --kms-location=KMS_LOCATION --kms-project=KMS_PROJECT]] [GCLOUD_WIDE_FLAG ...]

DESCRIPTION

Creates a backup of a Cloud Spanner database.

EXAMPLES

To create a backup asynchronously, run:

$ gcloud spanner backups create BACKUP_ID --instance=INSTANCE_NAME \ --database=DATABASE --expiration-date=2020-03-29T10:49:41Z \ --async

To create a backup synchronously, run:

$ gcloud spanner backups create BACKUP_ID --instance=INSTANCE_NAME \ --database=DATABASE --retention-period=2w

POSITIONAL ARGUMENTS

Backup resource - The Cloud Spanner backup to create. The arguments in this

group can be used to specify the attributes of this resource. (NOTE) Some attributes are not given arguments in this group but can be set in other ways. To set the project attribute:

provide the argument backup on the command line with a fully specified name;

provide the argument --project on the command line;

set the property core/project.

This must be specified.

BACKUP

ID of the backup or fully qualified identifier for the backup. To set the backup attribute:

  • provide the argument backup on the command line.

This positional argument must be specified if any of the other arguments in this group are specified.

--instance=INSTANCE

The Cloud Spanner instance for the backup. To set the instance attribute:

  • provide the argument backup on the command line with a fully specified name;

  • provide the argument --instance on the command line;

  • set the property spanner/instance.

REQUIRED FLAGS

--database=DATABASE

ID of the database from which the backup will be created.

Exactly one of these must be specified:
--expiration-date=EXPIRATION_DATE

Expiration time of the backup, must be at least 6 hours and at most 30 days from the time the request is received. See $ gcloud topic datetimes for information on date/time formats.

--retention-period=RETENTION_PERIOD

Retention period of the backup relative from now, must be at least 6 hours and at most 30 days. See $ gcloud topic datetimes for information on duration formats.

OPTIONAL FLAGS

--async

Return immediately, without waiting for the operation in progress to complete.

--version-time=TIMESTAMP

The backup will contain an externally consistent copy of the database at the timestamp specified by --version-time. If --version-time is not specified, the system will use the creation time of the backup.

--encryption-type=ENCRYPTION_TYPE

The encryption type of the backup. ENCRYPTION_TYPE must be one of:

customer-managed-encryption

Use the provided Cloud KMS key for encryption. If this option is selected, kms-key must be set.

google-default-encryption

Use Google default encryption.

use-database-encryption

Use the same encryption configuration as the database.

Key resource - Cloud KMS key to be used to create the Cloud Spanner backup. The

arguments in this group can be used to specify the attributes of this resource.

--kms-key=KMS_KEY

ID of the key or fully qualified identifier for the key. To set the kms-key attribute:

  • provide the argument --kms-key on the command line.

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

--kms-keyring=KMS_KEYRING

KMS keyring id of the key. To set the kms-keyring attribute:

  • provide the argument --kms-key on the command line with a fully specified name;

  • provide the argument --kms-keyring on the command line.

--kms-location=KMS_LOCATION

Cloud location for the key. To set the kms-location attribute:

  • provide the argument --kms-key on the command line with a fully specified name;

  • provide the argument --kms-location on the command line.

--kms-project=KMS_PROJECT

Cloud project id for the key. To set the kms-project attribute:

  • provide the argument --kms-key on the command line with a fully specified name;

  • provide the argument --kms-project on the command line.

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

These variants are also available:

$ gcloud alpha spanner backups create

$ gcloud beta spanner backups create