Back up and restore data Stay organized with collections Save and categorize content based on your preferences.
| Relevant to Cloud Firestore Standard edition and Cloud Firestore Enterprise edition. |
This page describes how to use theCloud Firestore scheduled backupsfeature. Use backups to protect your data from application-level datacorruption or from accidental data deletion.
Backups let you configure backup schedules to take daily or weeklybackups of the specified database. You can then use these backups to restoredata to a new database.
About backups
A backup is a consistent copy of the database at a point in time.The backup contains all data and index configurations at that pointin time.
A backup does not contain databasetime to live policies.A backup resides in the same location as the source database.Backups have a configurable retention period and are stored until the retentionperiod expires or until you delete the backup. Deleting the source database doesnot automatically delete related backups.
Cloud Firestore stores metadata related to backups and backupschedules related to a database.Cloud Firestore retains this metadatauntilall backups for the database expire or are deleted.
Creating or retaining backups does not affect the performance of reads orwrites in your live database.
Costs
When you use backups, you're charged for the following:
- The amount of storage used by each backup.
- For a restore operation, you're charged based on the size of the backup.
For more details and exact rates, see thePricing page.
Before you begin
This feature requires theBlaze pricing plan.Required roles
To get the permissions that you need to manage backups and backup schedules,ask your administrator to grant you one or more of the following Identity and Access Managementroles:
roles/datastore.owner: Full access to theCloud Firestore databaseroles/datastore.backupsAdmin: Read and write access to backupsroles/datastore.backupsViewer: Read access to backupsroles/datastore.backupSchedulesAdmin: Read and write access to backup schedulesroles/datastore.backupSchedulesViewer: Read access to backup schedulesroles/datastore.restoreAdmin: Permissions to initiate restore operations
Create and manage backup schedules
The following examples demonstrate how to set up a backup schedule. For eachdatabase, you can configure up to one daily backup schedule and up to one weeklybackup schedule. You cannot configure multiple weekly backups schedules fordifferent days of the week.
You cannot configure the exact time of day of the backup. Backups are taken atdifferent times each day. For weekly backupschedules, you can configure the day of the week to take a backup.
Create a backup schedule
Use one of the following tools to create a backup schedule.
Create a daily backup schedule
Google Cloud console
In the Google Cloud console, go to theDatabases page.
- In the list of databases, find the row for the database. In theScheduled backups column click eitherView backups orEdit settings, depending on whether a backup schedule exists.
- ClickEdit to edit disaster recovery settings.
- Select theDaily checkbox, set the retention period, and then clickSave.
Firebase CLI
To create a backup schedule for a database, use thefirebase firestore:databases:backups:schedules:create command.To create a daily backup schedule, set the--recurrence flag toDAILY:firebase firestore:backups:schedules:create \--database 'DATABASE_ID' \--recurrence 'DAILY' \--retentionRETENTION_PERIOD
Replace the following:
- DATABASE_ID: The ID of the database to back up. Set to
'(default)'for the default database. - RETENTION_PERIOD: Set this to a value up to 14 weeks (
14w).
Terraform
To create a daily backup schedule, create agoogle_firestore_backup_schedule resource.resource"google_firestore_backup_schedule""daily-backup"{project=PROJECT_IDdatabase=DATABASE_IDretention=RETENTION_PERIOD_SECONDSdaily_recurrence{}}
Replace the following:
- PROJECT_ID: The ID of the project.
- DATABASE_ID: The ID of the database to back up. Set to
'(default)'for the default database. You can also use aresource reference to a Terraform resource of type - RETENTION_PERIOD_SECONDS: Set this to a value in seconds, followed by "s". The maximum value is
8467200s(14 weeks).
google_firestore_database.Create a weekly backup schedule
Google Cloud console
In the Google Cloud console, go to theDatabases page.
- In the list of databases, find the row for the database. In theScheduled backups column click eitherView backups orEdit settings, depending on whether a backup schedule exists.
- ClickEdit to edit disaster recovery settings.
- Select theWeekly checkbox, select a backup day, set the retention period, and then clickSave.
Firebase CLI
To create a weekly backup schedule, set the--recurrence flag toWEEKLY and choose the--day-of-week:firebase firestore:backups:schedules:create \--database 'DATABASE_ID' \--recurrence 'WEEKLY' \--retentionRETENTION_PERIOD--day-of-weekDAY
- DATABASE_ID: The ID of the database to back up. Set to
'(default)'for the default database. - RETENTION_PERIOD: Set this to a value up to 14 weeks (
14w). - DAY: The day of the week to take the backup. Set to one of the following:
SUNDAYfor SundayMONDAYfor MondayTUESDAYfor TuesdayWEDNESDAYfor WednesdayTHURSDAYfor ThursdayFRIDAYfor FridaySATURDAYfor Saturday
Terraform
To create a weekly backup schedule, create agoogle_firestore_backup_schedule resource.resource"google_firestore_backup_schedule""weekly-backup"{project=PROJECT_IDdatabase=DATABASE_IDretention=RETENTION_PERIOD_SECONDSweekly_recurrence{day=DAY}}
Replace the following:
- PROJECT_ID: The ID of the project.
- DATABASE_ID: The ID of the database to back up. Set to
'(default)'for the default database. You can also use aresource reference to a Terraform resource of type - RETENTION_PERIOD_SECONDS: Set this to a value in seconds, followed by "s". The maximum value is
8467200s(14 weeks). - DAY: The day of the week to take the backup. Set to one of the following:
SUNDAYfor SundayMONDAYfor MondayTUESDAYfor TuesdayWEDNESDAYfor WednesdayTHURSDAYfor ThursdayFRIDAYfor FridaySATURDAYfor Saturday
google_firestore_database.List backup schedules
To list all backup schedules for a database, use one of the following methods:
Google Cloud console
In the Google Cloud console, go to theDatabases page.
- In the list of databases, find the row for the database. In theScheduled backups column click eitherView backups orEdit settings, depending on whether a backup schedule exists.
- TheDisaster recovery page opens. This page describes backup schedulesand lists available backups.
Firebase CLI
Use thefirebase firestore:backups:schedules:list command.firebase firestore:backups:schedules:list \--database 'DATABASE_ID'
'(default)' for the default database.Describe backup schedule
To retrieve information about a backup schedule, use one of the following methods:
Google Cloud console
In the Google Cloud console, go to theDatabases page.
- In the list of databases, find the row for the database. In theScheduled backups column click eitherView backups orEdit settings, depending on whether a backup schedule exists.
- TheDisaster recovery page opens. This page describes backup schedulesand lists available backups.
gcloud
Use thegcloud firestore backups schedules describe command:gcloud firestore backups schedules describe \--database='DATABASE_ID' \--backup-schedule=BACKUP_SCHEDULE_ID
- DATABASE_ID: The ID of the database to back up. Set to
'(default)'for the default database. - BACKUP_SCHEDULE_ID: The ID of a backup schedule. You can view the ID of each backup schedule when youlist all backup schedules.
Update a backup schedule
To update the retention period of a backup schedule, use one of the following methods:
Google Cloud console
In the Google Cloud console, go to theDatabases page.
- In the list of databases, find the row for the database. In theScheduled backups column click eitherView backups orEdit settings.
- ClickEdit to edit disaster recovery settings.
- Edit the backup schedule settings and then clickSave.
Firebase CLI
Use thefirebase firestore:backups:schedules:update command:firebase firestore:backups:schedules:update \BACKUP_SCHEDULE \--retentionRETENTION_PERIOD
- BACKUP_SCHEDULE: The full resource name of a backup schedule. You can view the name of each backup schedule when youlist all backup schedules.
- RETENTION_PERIOD: Set this to a value up to 14 weeks (
14w).
You can update the retention period of a backup schedule, but you cannot update its recurrence. If you need a backup schedule with a different recurrence, delete the old backup schedule if it is no longer required and create a new backup schedule with the preferred recurrence.
Delete a backup schedule
To delete a backup schedule, use one of the following methods:
Google Cloud console
In the Google Cloud console, go to theDatabases page.
- In the list of databases, find the row for the database. In theScheduled backups column click eitherView backups orEdit settings, depending on whether a backup schedule exists.
- ClickEdit to edit disaster recovery settings.
- Edit the backup schedule settings and then clickSave.
Firebase CLI
Use thefirebase firestore:backups:schedules:delete command:firebase firestore:backups:schedules:delete \BACKUP_SCHEDULE
- BACKUP_SCHEDULE: The full resource name of a backup schedule. You can view the name of each backup schedule when youlist all backup schedules.
Note that deleting a backup schedule won't delete backups already created bythis schedule. You can wait for them to expire after their retention period, orto manually delete a backup, seedelete backup.
Manage backups
List backups
To list available backups, use one of the following methods:
Google Cloud console
In the Google Cloud console, go to theDatabases page.
- In the list of databases, find the row for the database. In theScheduled backups column click eitherView backups orEdit settings, depending on whether a backup schedule exists.
- ClickEdit to edit disaster recovery settings.
- Edit the backup schedule settings and then clickSave.
Firebase CLI
Use thefirebase firestore:backups:list command:firebase firestore:backups:list
--location flag:firebase firestore:backups:list \--location=LOCATION
LOCATION with the name of aCloud Firestorelocation.Describe a backup
To view details about a backup, use one of the following methods:
Google Cloud console
In the Google Cloud console, go to theDatabases page.
- In the list of databases, find the row for the database. In theScheduled backups column click eitherView backups orEdit settings, depending on whether a backup schedule exists.
- TheDisaster recovery page opens. This page describes backup schedulesand lists available backups.
Firebase CLI
Use thefirebase firestore:backups:get command:firebase firestore:backups:getBACKUP
- BACKUP: The full resource name of a backup. You can view the name of each backup when youlist all backups.
Delete backup
To delete a backup, use one of the following methods.
Warning: You cannot recover a deleted backup.Google Cloud console
In the Google Cloud console, go to theDatabases page.
- In the list of databases, find the row for the database. In theScheduled backups column click eitherView backups orEdit settings, depending on whether a backup schedule exists.TheDisaster recovery page opens. This page describes backup schedulesand lists available backups.
- In theBackups table, find the row for a backup and in theActions column, clickView more(). ClickDelete.
- Confirm the action using the text field and clickDelete.
Firebase CLI
Use thefirebase firestore:backups:delete command:firebase firestore:backups:delete \BACKUP
- BACKUP: The full resource name of a backup. You can view the name of each backupwhen youlist all backups.
Restore data from a database backup
A restore operation writes the data from a backup to a newCloud Firestoredatabase.
To begin a restore operation, use one of the following methods:
Google Cloud console
In the Google Cloud console, go to theDatabases page.
- In the list of databases, find the row for the database. In theScheduled backups column click eitherView backups orEdit settings, depending on whether a backup schedule exists.TheDisaster recovery page opens. This page describes backup schedulesand lists available backups.
- In theBackups table, find the row for a backup and in theActionscolumn, clickView more(). ClickRestore withCloud Shell.
TheCloud Shell panel opens with agcloud CLI commandto restore from the selected backup. ReplaceID_OF_NEW_DATABASE withan ID for the database and run the command.
Running the command returns a response with more information about theoperation. The database soon appears in your list of databases. The restoreoperation will take some time and must complete before the database is accessible.
Firebase CLI
Use thefirebase firestore:databases:restore command:firebase firestore:databases:restore \--backup 'BACKUP' \--database 'DATABASE_ID'
- BACKUP: The full resource name of a backup. You can view the name of each backup when youlist all backups.
- DATABASE_ID: A database ID for the new database. You cannot use a database ID that is already in use.
Limitations
A restore operation does not restoreApp Engine search data orblob entities from a(default) database. This data is only valid for the(default) database, and it won't be useful if you restore from(default) to a database which does not support such data, so it is excluded from backups.
What to do after restoring
After you finish restoring, you should do the following:
Verify that appropriateIAM controls are applied to your new database.
If you previously usedTTL policies, reapply them to the new database. TTL policies are not included in backups and are not automatically reapplied to restored databases.
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 2026-02-18 UTC.