Updated Guide on setting up Automated Backups for Cloud Firestore

In a previous article, we explored how to setup automated backups for Firestore database, but recently Google released a new feature that allows for creating backups for your Firestore data.

This article, we'd be exploring how to setup automated daily Firestore backups, without the need of coding.

Introduction to Automated Backups

We use the new gcloud command: gcloud alpha firestore backups to initiate and manage the backups, so billing should be enabled on your Firebase Project.

Setting up the Backup Schedule

We want to create a schedule to run daily:

Copy
gcloud alpha firestore backups schedules create \
--database='your-database-name' \
--recurrence=daily \
--retention=5w

Where:

  • your-database-name is the name of the Firestore database we want to backup. If you're using the default Firestore instance, it's likely to be (default)
  • 5w is how long we want to keep this backup for, this value can be setup up to 14 weeks.

screenshots

Verifying the Setup

To confirm that the schedule was succesfull, you can run the below command to display a list of backup schedules:

Copy
gcloud alpha firestore backups schedules list \
--database='(default)'

screenshots

Viewing Available Backups

And, lastly, we can see the available backups for the Firestore database.

Copy
gcloud alpha firestore backups list \
--format="table(name, database, state)"

Conclusion

The introduction of ths new commands has significantly simplified the process of setting up automated backups for Firestore. By following the steps in this guide, you should have an automated backup system up and running.

Comments

Edwards Moses - Web & Mobile — React & React Native Consultant

Edwards Moses
Web & Mobile — React & React Native Consultant

I'm Edwards, based in Lagos, Nigeria.
Freelancer Software Developer — collaborating with teams to craft extraordinary products.

From conception through to completion, I find immense joy in witnessing the evolution of an idea into a fully realized product in the hands of users. Check out my projects and articles to see what I've been up to lately.

Ready to bring your ideas to life?