Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS RDS backups are incremental or differential?

In the AWS RDS documentation, it is written that automatic daily backups are performed. But it is not specified whether it is incremental or differential.

https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html

Can you please tell the type of backup AWS performs?

like image 501
Aniket Avatar asked Dec 18 '22 00:12

Aniket


1 Answers

The most meaningful answer is "neither."

RDS snapshots are full backups... but they are initially created incrementally.

RDS snapshots are EBS snapshots of the underlying block storage device(s).

Amazon RDS creates a storage volume snapshot of your DB instance, backing up the entire DB instance and not just individual databases.

https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_CreateSnapshot.html

Logically, each snapshot is a standalone snapshot. You can delete older ones, and still successfully restore newer ones. You can delete all but one, and still restore that one, no matter which one.

They are actually created as incremental snapshots, with only the blocks that differ from the previous snapshot being captured from the disk and stored¹... so a snapshot completes much faster when a smaller amount of change has occurred since the prior snapshot... but the captured data is not "in" a specific snapshot -- each snapshot contains pointers to all of the snapshot data blocks that are required to reconstruct it -- so if a newer snapshot depends on data that was originally captured in an older snapshot, that's fine: deleting the older snapshot does not cause the data to actually be discarded, as long as the data is still referenced by at least one snapshot.

When you delete a snapshot, only the data referenced exclusively by that snapshot is removed. Deleting previous snapshots of a volume does not affect your ability to restore volumes from later snapshots of that volume.

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-deleting-snapshot.html


¹ only the blocks that differ is possible because the EBS infrastructure knows which blocks on your volume have remained untouched since the previous snapshot that is still being stored. When RDS asks EBS to snapshot the underlying storage volume, EBS only reads the blocks that have been touched. How, exactly, this works isn't documented but there's clear evidence of this sort of optimization in the short amount of time needed for taking snapshots when very little data has changed, compared to longer times when many changes have occurred.

like image 133
Michael - sqlbot Avatar answered Jan 29 '23 12:01

Michael - sqlbot