gcloud firestore databases restore

NAME
gcloud firestore databases restore - restores a Cloud Firestore database from a backup
SYNOPSIS
gcloud firestore databases restore--destination-database=DESTINATION_DATABASE--source-backup=SOURCE_BACKUP[--tags=[KEY=VALUE,…]][--encryption-type=ENCRYPTION_TYPE :--kms-key-name=KMS_KEY_NAME][GCLOUD_WIDE_FLAG]
EXAMPLES
To restore a database from a backup.
gcloudfirestoredatabasesrestore--source-backup=projects/PROJECT_ID/locations/LOCATION_ID/backups/BACKUP_ID--destination-database=DATABASE_ID

To restore a database from a backup with tags.

gcloudfirestoredatabasesrestore--source-backup=projects/PROJECT_ID/locations/LOCATION_ID/backups/BACKUP_ID--destination-database=DATABASE_ID--tags=key1=value1,key2=value2

To restore to a CMEK-enabled database.

gcloudfirestoredatabasesrestore--source-backup=projects/PROJECT_ID/locations/LOCATION_ID/backups/BACKUP_ID--destination-database=DATABASE_ID--encryption-type=customer-managed-encryption--kms-key-name=projects/PROJECT_ID/locations/LOCATION_ID/keyRings/KEY_RING_ID/cryptoKeys/CRYPTO_KEY_ID
REQUIRED FLAGS
--destination-database=DESTINATION_DATABASE
Destination database to restore to. Destination database will be created in thesame location as the source backup.

This value should be 4-63 characters. Valid characters are /[a-z][0-9]-/ withfirst character a letter and the last a letter or a number. Must not beUUID-like /[0-9a-f]8(-[0-9a-f]4)3-[0-9a-f]12/.

Using "(default)" database ID is also allowed.

For example, to restore to databasetestdb:

gcloudfirestoredatabasesrestore--destination-database=testdb
--source-backup=SOURCE_BACKUP
The source backup to restore from.

For example, to restore from backupcf9f748a-7980-4703-b1a1-d1ffff591db0 in us-east1:

gcloudfirestoredatabasesrestore--source-backup=projects/PROJECT_ID/locations/us-east1/backups/cf9f748a-7980-4703-b1a1-d1ffff591db0
OPTIONAL FLAGS
--tags=[KEY=VALUE,…]
Tags to attach to the destination database. Example:--tags=key1=value1,key2=value2

For example, to attach tags to a database:

$ --tags=key1=value1,key2=value2

The encryption configuration of the new database being created from the backup.If not specified, the same encryption settings as the backup will be used.

To create a CMEK-enabled database:

gcloudfirestoredatabasesrestore--encryption-type=customer-managed-encryption--kms-key-name=projects/PROJECT_ID/locations/LOCATION_ID/keyRings/KEY_RING_ID/cryptoKeys/CRYPTO_KEY_ID

To create a Google-default-encrypted database:

gcloudfirestoredatabasesrestore--encryption-type=google-default-encryption

To create a database using the same encryption settings as the backup:

gcloudfirestoredatabasesrestore--encryption-type=use-source-encryption
--encryption-type=ENCRYPTION_TYPE
The encryption type of the destination database.ENCRYPTION_TYPE must be one of:use-source-encryption,customer-managed-encryption,google-default-encryption.

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

--kms-key-name=KMS_KEY_NAME
The resource ID of a Cloud KMS key. If set, the database created will be aCustomer-Managed Encryption Key (CMEK) database encrypted with this key. Thisfeature is allowlist only in initial launch.

Only a key in the same location as this database is allowed to be used forencryption. For Firestore's nam5 multi-region, this corresponds to Cloud KMSlocation us. For Firestore's eur3 multi-region, this corresponds to Cloud KMSlocation europe. Seehttps://cloud.google.com/kms/docs/locations.

This value should be the KMS key resource ID in the format ofprojects/{project_id}/locations/{kms_location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}.How to retrieve this resource ID is listed athttps://cloud.google.com/kms/docs/getting-resource-ids#getting_the_id_for_a_key_and_version.This flag must only be specified when encryption-type iscustomer-managed-encryption.

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:
gcloudalphafirestoredatabasesrestore
gcloudbetafirestoredatabasesrestore

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-07-15 UTC.