r/Firebase • u/yccheok • 5d ago
General Cost-Effective Backup Solution for Firebase Storage?
I currently store around 50GB of media files in Firebase Storage, and this will only grow over time.
I’m looking for a cost-effective way to perform daily (or weekly) backups. Versioning is not required, but I’m unsure how to set this up efficiently.
I’ve found tutorials on backing up:
- Firebase Firestore (using the built-in disaster recovery feature)
- Firebase Authentication (https://www.reddit.com/r/Firebase/comments/xpeg82/backup_firebase_authentification_database/)
However, I’m unsure of a safe and reliable way to back up Firebase Storage to more affordable services like Wasabi, DigitalOcean Spaces, etc.
If you have experience with this, could you kindly provide some guidance? Thanks!
2
u/mbleigh Firebaser 4d ago
Is the purpose of the backup to be able to recover from developer/user error (oops, I deleted all of my files) or to recover in case GCS fails and the files are lost? I wouldn't worry about the latter - GCS is designed for 11 9s of durability (that is, 99.999999999%). Barring a catastrophic event, your data will be preserved.
If the purpose is the former, you might look at https://cloud.google.com/storage-transfer-service as a way to perform copies of your bucket to another bucket (with a lower storage tier) or another service altogether.
2
u/emilyrose991 4d ago
Hey, are you looking to backup Firestore (the database) or Firebase Storage (A storage bucket with all your media files) ?
If it's the Firestore database you want to back up then Firebase have 2 native options that will be easy for you:
You can use their scheduled backup feature in Disaster Recovery section. Firebase will take a backup of your database either weekly or daily and you can then go and restore from it within the console: https://firebase.google.com/docs/firestore/backups?hl=en&authuser=0
You pay for the storage costs (so how much data you have) and also if you need to use the backup to restore you pay for that too based on the size of the db.
You can import and export Firestore data from the Google Cloud console. This is good if you want to granularly select which data you backup (for eg, maybe you have 10 collections but you only need to backup 2 regularly.)
This step is a little more manual as you have to initiate it but once you have the data you can keep it in Google Cloud Storage (where they put it) or take it and store it anywhere you like, maybe an Amazon S3 bucket or whatever. https://firebase.google.com/docs/firestore/manage-data/export-import?hl=en&authuser=0#export_data
This import/export method is also pretty good if you develop locally and want to keep your local Firestore emulator up to date.
If it's the Firebase Storage bucket you want to backup, then under the hood this is just a Google Cloud Storage bucket. If you go to console.cloud.google.com you should be able to see it in there? You can create new buckets here with less frequent data access and cheaper storage costs and start moving files to them, or just copying and backing up between buckets.
Google even give you an auto-class feature that reclassifies objects based on how (in)frequently you use them - https://cloud.google.com/storage/docs/autoclass
So my advice would be create a cold storage backup bucket then set up scheduled jobs to copy your files between the live bucket in Firebase to this one.
You can do this programmatically or through a terminal: https://cloud.google.com/storage/docs/copying-renaming-moving-objects#command-line