Amazon RDS
backup
snapshot
cloud computing
database management

How does Amazon RDS backup/snapshot actually work?

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

Overview

Amazon Relational Database Service (RDS) provides two powerful options for backing up your databases: automated backups and database snapshots. Both are integral to ensuring data durability and facilitating recovery, but they operate in different ways. This article delves into the mechanisms of each, clarifying their operations and use-cases, which enables database administrators to make well-informed decisions about data protection in the AWS cloud.

Automated Backups

Automated backups allow you to recover your database to any point in time within a retention period. This feature is crucial in production environments, where minimal data loss is a priority.

How It Works

  1. Retention Period Management: By default, Amazon RDS retains automated backups for seven days, but this can be configured. The retention period can be modified up to a maximum of 35 days.
  2. Storage and Cost: The storage for automated backups is provided at no additional cost up to the size of your primary DB instance.
  3. Backup Initiation: Backups are initiated during a 30-minute window defined by the user. During this period, RDS performs a storage volume snapshot and backs up transaction logs.
  4. Incremental Backups: After the initial full snapshot, automated backups are incremental. This means that only the data that has changed since the last backup will be saved in subsequent backups.
  5. Point-in-Time Recovery (PITR): With transaction logs continuously archived, assuming backups are taken with this in mind, database recovery to any specific time can be achieved within the retention window.

Example

Suppose you have a database with 100 GB of storage. RDS will handle the initial full snapshot of 100 GB, and if your daily changes are about 1 GB, the daily incremental backup will occupy 1 GB each day.

Manual Snapshots

Snapshots are similar to automated backups, but they are initiated manually and can retain data beyond the typical automated backup retention periods.

How It Works

  1. User-Initiated: Manual snapshots can be created at any time and are initiated by the user via the AWS Management Console, CLI, or API.
  2. Storage: Unlike automated backups, storage for snapshots does incur charges based on the data size.
  3. Persistency: Snapshots remain until explicitly deleted, providing users with long-term data storage options.
  4. Use in Restorations: When restoring from a snapshot, a new RDS instance is created with the data contained in the snapshot, effectively providing a clone of the original database at the time the snapshot was taken.

Example

For periodic archiving, you might take a manual snapshot every month and retain these snapshots indefinitely for audit purposes, or financial year tracking. If your original data size is 200 GB, each of these snapshots will account for this much storage.

Recovery

Both automated backups and manual snapshots can be utilized for recovery purposes. Restorations involve either creating a new database instance from a snapshot or recovering to a specific point in time when using automated backups.

Recovery Process

  1. Automated Recovery: Select the point in time to restore, choose the instance settings, and initiate the recovery. This involves recovering from the combination of the last full snapshot and the necessary transaction logs.
  2. Snapshot Recovery: Choose the snapshot from which to restore and configure the instance parameters for the new database.

Cost Considerations

The costs associated with RDS backups and snapshots differ:

  • Automated Backups: Free storage up to the size of the provisioned database instance. Additional charges apply for storage beyond this size.
  • Manual Snapshots: Charged based on the size of the data stored in the snapshot.

Summary Table

FeatureAutomated BackupsManual Snapshots
InitiationConfigured retention period, managed by AWS User-defined backup windowsUser-initiated, via Console/CLI/API
RetentionUp to 35 daysIndefinite, until explicitly deleted
Storage CostFree up to DB sizeCharged based on snapshot data size
IncrementalYesNo
PurposeRoutine backups, point-in-time recoveryLong-term retention, archival
RestorationCan recover to a point-in-time within retentionCreates a new DB instance

Best Practices

  • Determine Retention Needs: Configure your backup retention periods according to the RPO (Recovery Point Objective) of your business.
  • Use of Snapshots for Longer Terms: For applications requiring long-term data retention or periodic archiving, employ manual snapshots.
  • Monitor Storage Costs: Regularly review the cost associated with snapshots and clean up unnecessary data to minimize expenses.
  • Testing Recovery Procedures: Regularly test recovery procedures from snapshots and backups to ensure business continuity.

Understanding how Amazon RDS backups and snapshots work will greatly enhance your data management strategy, ensuring your databases are reliably safeguarded against accidental loss or system failures.


Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

All Rights Reserved.