2.1.3.4. Data Backups and Replication Strategies
2.1.3.4. Data Backups and Replication Strategies
💡 First Principle: Data backups and replication fundamentally ensure business continuity by safeguarding against data loss, guaranteeing data durability and availability.
Protecting your data from loss due to accidental deletion, corruption, or disaster is paramount. Data backups and replication are the core strategies to achieve this.
- Data Backups: Creating copies of data at a specific point in time.
- Purpose: Allow for point-in-time recovery, crucial for restoring data to a specific historical state in case of data corruption or accidental deletion.
- AWS Services: AWS Backup (centralized backup management), Amazon S3 (for storing backups), Amazon EBS Snapshots, Amazon RDS Automated Backups.
- Automating EBS snapshots: Amazon Data Lifecycle Manager (DLM) (or an AWS Backup plan) creates EBS snapshots on a schedule — as often as hourly — and deletes old ones by retention rule; snapshot frequency sets the achievable RPO. An EBS volume is replicated only within its AZ and is designed for 99.8–99.9% durability (99.999% for io2), far below S3's 11 nines, so snapshots are the backup.
- Data Replication: Creating and maintaining multiple, often near real-time, copies of data across different locations.
- Purpose: Provides near real-time copies, enabling rapid failover and high availability by maintaining synchronized data across multiple locations. It helps minimize data loss and downtime.
- AWS Services: Amazon RDS Multi-AZ (synchronous replication for databases), Amazon S3 Cross-Region Replication (CRR), Amazon DynamoDB Global Tables.
Key Concepts:
- Backups: Point-in-time copies, restore to a specific state.
- Replication: Near real-time copies, rapid failover, high availability.
- EBS snapshots: A snapshot of an encrypted volume is encrypted; a snapshot of an unencrypted volume is unencrypted (encrypt it by copying the snapshot with encryption enabled). A snapshot cannot be attached — restore by creating a new volume from the snapshot and attaching that volume to an instance.
- Guarding against accidental deletion: RDS deletion protection; S3 Versioning + MFA Delete (MFA required to permanently delete versions or change the versioning state); EC2 termination protection; AWS Backup Vault Lock (protects the backups themselves, not the source resource).
- S3 replication prerequisites: Versioning on both buckets, and an IAM role that S3 assumes in the source account to read and replicate objects. Across accounts, the destination bucket policy must also allow that role to replicate into it.
- RPO (Recovery Point Objective): Max data loss tolerated (influences frequency).
- RTO (Recovery Time Objective): Max downtime tolerated (influences recovery speed).
Scenario: For a critical production database, configuring Amazon RDS automated backups combined with cross-Region replication provides robust disaster recovery and enhanced data resilience.
Visual: Data Backup vs. Replication
⚠️ Common Pitfall: Relying solely on replication for data protection. Replication protects against infrastructure failures but will replicate data corruption or accidental deletions. Backups are necessary for point-in-time recovery.
Key Trade-Offs:
- RPO/RTO vs. Cost: Achieving very low RPO/RTO (near-zero data loss/downtime) through continuous replication is significantly more expensive than strategies with higher RPO/RTO (e.g., daily backups).
Reflection Question: How do you balance backup frequency, replication latency, and cost to meet different data criticality levels and satisfy both Recovery Point Objective (RPO) and Recovery Time Objective (RTO) requirements for your applications?