How can you manage backups in Firebase-Firestore

Photo by Nathana Rebouças on Unsplash
gcloud config set project PROJECT_NAME
gcloud alpha firestore export gs://BUCKET_NAME
  1. You will have to create a new bucket corresponding to your project and give permissions to your bucket.
  2. While creating bucket make sure your location supports import/export of data. You can select Multi Region with US.
  3. Make sure you choose the correct bucket type depending on your requirement. I would Nearline for storing backups. You can read more about the storage classes and their pricing before deciding.
  4. Now we must make sure that our cloud function can run data exports by granting our service account yourproject@appspot.gserviceaccount.com the Datastore Import Export Admin role. This can be done using GCP IAM interface or from the command line :
gcloud projects add-iam-policy-binding yourproject \
--member serviceAccount:yourproject@appspot.gserviceaccount.com \
--role roles/datastore.importExportAdmin
firebase deploy --only functions:scheduledFirestoreExport
Photo by Kelly Sikkema on Unsplash
Photo by Deniz Altindas on Unsplash

--

--

--

Developer | Thinker | Learner

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

[015] Introduction to Python Basics: Short Circuiting, Logical Operators

Benchmarking my (micro) SD cards for Raspberry Pi

Patching Intel’s SFP+ driver for …

More than just code. 5 other simple things every aspiring Web Developer needs to learn.

Getting Started: Let’s Git down to business

How to Add R to Jupyter Notebook

Sinusoidal functions(TRIGONOMETRY)

How to Create a Kubernetes Deployment With Helm Charts in AWS

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Srijan Shrestha

Srijan Shrestha

Developer | Thinker | Learner

More from Medium

The 5 Most Popular Backend Frameworks of 2021–0707 Inc.

The Three Elements of an Effective Game Development Team

The improper development and still existing outdated security around the web

Joy and Misery | A Month of WebGL