Skip to content

RDS automated backup retention period and restore

0

Hello, I'm new to AWS and having a hard time to understand how automated backup and restore work. In the documentation ( Introduction to backups ), it says "The first snapshot of a DB instance contains the data for the full database. Subsequent snapshots of the same database are incremental, which means that only the data that has changed after your most recent snapshot is saved."

So does it mean If I restore from the latest snaphot, I could lose the data added to the rds instance a long time ago? For example, what happens in the following scenario?

I set the backup retention period to 1 day when I created a rds instance so I expect the aws would keep the system snapshots up to the past 1 day On the first day, I added 5 data rows with id 1 to 5 and the first system snapshot would contain the data with id 1 to 5. On the second day, I added 5 data rows with id 6 to 10 and the second system snaphot would only contain the data with id 6 to 10 ( because the documentation says Subsequent snapshots of the same database are incremental, which means that only the data that has changed after your most recent snapshot is saved. ) On the third day, I added 5 data rows with id 11 to 15 and the third system snapshot would only contain the data with id 11 to 15 On the forth day, I added 5 data rows with id 16 to 20 and the forth system snapshot would only contain the data with id 16 to 20.

And on the fifth day, I want to restore from the latest snapshot but because I set the backup retention period to 1 day when I created the rds instance, I believe the aws would delete the system snapshots taken on the first, second day and only keep the system snapshots taken on the third day or the forth day. and becuase the documentation says "Subsequent snapshots of the same database are incremental, which means that only the data that has changed after your most recent snapshot is saved." I wonder If I restore from the latest system snapshot, does the new rds instance created with the latest snapshot lose data added on the first, second day ( data with id 1 to 10 ) and only contains the data added on the third or the forth day? ( data with id 11 to 20 )

asked 2 years ago651 views

2 Answers
1
Accepted Answer

First, let me assure you that you won't lose any data in the scenario you described. The key to understanding this lies in correctly interpreting what "incremental" means in the context of RDS snapshots. Let's break it down:

  1. Full vs. Incremental Snapshots:

    • The first snapshot is indeed a full snapshot of your entire database.
    • Subsequent snapshots are incremental, but this doesn't mean they only contain new data.
  2. What "Incremental" Really Means:

    • Incremental snapshots save storage space and time by only storing the changes since the last snapshot.
    • However, when you restore from any snapshot, you get the full state of the database at that point in time.
  3. Retention Period:

    • The retention period determines how long AWS keeps your automated backups.
    • It doesn't affect the completeness of your data within each snapshot.

Now, let's address your specific scenario:

Day 1: Full snapshot with rows 1-5

Day 2: Incremental snapshot (effectively contains rows 1-10)

Day 3: Incremental snapshot (effectively contains rows 1-15)

Day 4: Incremental snapshot (effectively contains rows 1-20)

Day 5: Restore point

When you restore on Day 5, even though you only have the last day's snapshot due to your 1-day retention period, this snapshot contains the full state of your database as of Day 4. This means it includes ALL data from Day 1 to Day 4 (rows 1-20).

The incremental nature of the snapshots is about how AWS stores the data internally, not about what data is available when you restore. Each snapshot, while stored incrementally, represents the complete state of your database at that point in time.

So, to directly answer your question: No, you won't lose the data added on the first and second days. When you restore from the latest snapshot, you'll get all the data up to the point of that snapshot, including rows 1-20 in your example.

Enter image description here

AWS
EXPERT

answered 2 years ago

  • Thank you for your detailed explanation!

1

Hello.

No, the data remains in the new snapshot even if you delete the old backup.
In other words, all IDs from 1 to 20 will remain in the database when restored.
I think the explanation in the following document will be helpful.
https://docs.aws.amazon.com/ebs/latest/userguide/ebs-deleting-snapshot.html#ebs-deleting-snapshot-incremental

EXPERT

answered 2 years ago

AWS
EXPERT

reviewed 2 years ago

  • Thank you for your answer!

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.