Backups
Learn how backup works in Cosmos DB and how to restore data when needed.
Introduction
Backups are a critical part of any service architecture. They let us restore the business in case of accidental deletion or data corruption. Almost everything can be restored, minus some configurations:
Data
Containers
Databases
Accounts
Cosmos DB offers two different backup options that can be set at the account level:
Periodical backup
Continuous backup
The data is copied on Azure Blob Storage, encrypted with the same key used for the primary SSD storage.
Note: Backups don’t affect performance, availability, or RU consumption.
Periodic backup
In Cosmos DB, periodic backup is the default option, which copies the data on a configurable regular interval. Included in the price, we get the following configuration:
Backups are created every 4 hours.
Backups are retained for 8 hours (two backups).
Backups are retained for 30 days if the database or container is deleted.
Each backup also has two copies:
One in the same region as the write region.
For multi-write region accounts, one of the regions is used.
One on a different region through geo-redundant storage (GRS).
Configuration
There are three options we can set for periodic backups:
Backup interval
Backup retention
Storage redundancy
Get hands-on with 1400+ tech skills courses.