gcloud beta spanner backups create Stay organized with collections Save and categorize content based on your preferences.
- NAME
- gcloud beta spanner backups create - creates a backup of a Cloud Spanner database
- SYNOPSIS
gcloud beta 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-keys=[KMS_KEYS,…] | [--kms-key=KMS_KEY:--kms-keyring=KMS_KEYRING--kms-location=KMS_LOCATION--kms-project=KMS_PROJECT]][GCLOUD_WIDE_FLAG …]
- DESCRIPTION
(BETA)Creates a backup of a Cloud Spanner database.- EXAMPLES
- To create a backup asynchronously, run:
gcloudbetaspannerbackupscreateBACKUP_ID--instance=INSTANCE_NAME--database=DATABASE--expiration-date=2020-03-29T10:49:41Z--asyncTo create a backup synchronously, run:
gcloudbetaspannerbackupscreateBACKUP_ID--instance=INSTANCE_NAME--database=DATABASE--retention-period=2w - POSITIONAL ARGUMENTS
- Backup resource - The Cloud Spanner backup to create. The arguments in thisgroup can be used to specify the attributes of this resource. (NOTE) Someattributes are not given arguments in this group but can be set in other ways.
To set the
projectattribute:- provide the argument
backupon the command line with a fullyspecified name; - provide the argument
--projecton 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
backupattribute:- provide the argument
backupon the command line.
This positional argument must be specified if any of the other arguments in thisgroup are specified.
- provide the argument
--instance=INSTANCE- The Cloud Spanner instance for the backup.
To set the
instanceattribute:- provide the argument
backupon the command line with a fullyspecified name; - provide the argument
--instanceon the command line; - set the property
spanner/instance.
- provide the argument
- provide the argument
- Backup resource - The Cloud Spanner backup to create. The arguments in thisgroup can be used to specify the attributes of this resource. (NOTE) Someattributes are not given arguments in this group but can be set in other ways.
- 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 fromthe time the request is received. See
$gcloud topic datetimesfor information on date/time formats. --retention-period=RETENTION_PERIOD- Retention period of the backup relative from now, must be at least 6 hours andat most 30 days. See
$gcloud topic datetimesfor 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 thetimestamp specified by
--version-time. If--version-timeis not specified, the system will use the creationtime of the backup. --encryption-type=ENCRYPTION_TYPE- The encryption type of the backup.
ENCRYPTION_TYPEmustbe 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.
- KMS key name group
At most one of these can be specified:
- Key resource - Cloud KMS key(s) to be used to create the Cloud Spanner backup.This represents a Cloud resource. (NOTE) Some attributes are not given argumentsin this group but can be set in other ways.
To set the
kms-projectattribute:- provide the argument
--kms-keyson the command line with a fullyspecified name.
To set the
kms-locationattribute:- provide the argument
--kms-keyson the command line with a fullyspecified name.
To set the
kms-keyringattribute:- provide the argument
--kms-keyson the command line with a fullyspecified name.
--kms-keys=[KMS_KEYS,…]- IDs of the keys or fully qualified identifiers for the keys.
To set the
kms-keyattribute:- provide the argument
--kms-keyson the command line.
- provide the argument
- provide the argument
- Key resource - Cloud KMS key to be used to create the Cloud Spanner backup. Thearguments 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-keyattribute:- provide the argument
--kms-keyon the command line.
This flag argument must be specified if any of the other arguments in this groupare specified.
- provide the argument
--kms-keyring=KMS_KEYRING- KMS keyring id of the key.
To set the
kms-keyringattribute:- provide the argument
--kms-keyon the command line with a fullyspecified name; - provide the argument
--kms-keyringon the command line.
- provide the argument
--kms-location=KMS_LOCATION- Cloud location for the key.
To set the
kms-locationattribute:- provide the argument
--kms-keyon the command line with a fullyspecified name; - provide the argument
--kms-locationon the command line.
- provide the argument
--kms-project=KMS_PROJECT- Cloud project id for the key.
To set the
kms-projectattribute:- provide the argument
--kms-keyon the command line with a fullyspecified name; - provide the argument
--kms-projecton the command line.
- provide the argument
- Key resource - Cloud KMS key(s) to be used to create the Cloud Spanner backup.This represents a Cloud resource. (NOTE) Some attributes are not given argumentsin this group but can be set in other ways.
- 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 helpfor details. - NOTES
- This command is currently in beta and might change without notice. Thesevariants are also available:
gcloudspannerbackupscreategcloudalphaspannerbackupscreate
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 2025-06-24 UTC.