Point-in-time recovery (PITR) helps you restore your database to any moment in the past 35 days. It protects your data from accidental changes or deletions.
Point-in-time recovery (PITR) in DynamoDB
aws dynamodb update-continuous-backups --table-name <TableName> --point-in-time-recovery-specification PointInTimeRecoveryEnabled=true aws dynamodb restore-table-to-point-in-time --source-table-name <TableName> --target-table-name <NewTableName> --restore-date-time <ISO8601Timestamp>
Use update-continuous-backups to enable or disable PITR on your table.
Use restore-table-to-point-in-time to create a new table restored to a specific time.
MusicCollection.aws dynamodb update-continuous-backups --table-name MusicCollection --point-in-time-recovery-specification PointInTimeRecoveryEnabled=true
MusicCollectionBackup restored to May 1, 2024, at noon UTC.aws dynamodb restore-table-to-point-in-time --source-table-name MusicCollection --target-table-name MusicCollectionBackup --restore-date-time 2024-05-01T12:00:00Z
First, we enable PITR on the Books table. Then, we restore it to a new table BooksRestored as it was on June 1, 2024, at 10 AM UTC.
aws dynamodb update-continuous-backups --table-name Books --point-in-time-recovery-specification PointInTimeRecoveryEnabled=true aws dynamodb restore-table-to-point-in-time --source-table-name Books --target-table-name BooksRestored --restore-date-time 2024-06-01T10:00:00Z
PITR keeps data changes for the last 35 days only.
Restoring creates a new table; it does not overwrite the original.
Enabling PITR may increase your costs slightly because of extra backups.
PITR lets you recover your DynamoDB table to any second in the past 35 days.
You enable PITR with update-continuous-backups and restore with restore-table-to-point-in-time.
Restoring creates a new table; your original data stays safe.
Practice
Solution
Step 1: Understand PITR functionality
PITR allows restoring a DynamoDB table to a specific second in the past 35 days.Step 2: Compare options with PITR purpose
Options A, B, and D describe unrelated features; only To restore a table to any second within the last 35 days matches PITR's main purpose.Final Answer:
To restore a table to any second within the last 35 days -> Option DQuick Check:
PITR = Restore to any second in 35 days [OK]
- Confusing PITR with daily backups
- Thinking PITR deletes old data
- Assuming PITR changes table capacity
Orders?Solution
Step 1: Identify correct command to enable PITR
The command to enable PITR isupdate-continuous-backupswith the flag--point-in-time-recovery-specification PointInTimeRecoveryStatus=ENABLED.Step 2: Check options for syntax correctness
aws dynamodb update-continuous-backups --table-name Orders --point-in-time-recovery-specification PointInTimeRecoveryStatus=ENABLED matches the correct syntax; others use invalid commands or flags.Final Answer:
aws dynamodb update-continuous-backups --table-name Orders --point-in-time-recovery-specification PointInTimeRecoveryStatus=ENABLED -> Option CQuick Check:
Enable PITR = update-continuous-backups with PointInTimeRecoveryStatus=ENABLED [OK]
- Using non-existent commands like enable-pitr
- Confusing backup start with PITR enable
- Trying to enable PITR during restore
aws dynamodb restore-table-to-point-in-time --source-table-name Sales --target-table-name SalesBackup --restore-date-time 1714564800
Solution
Step 1: Understand restore-table-to-point-in-time behavior
This command creates a new table with the restored data; it does not overwrite the source table.Step 2: Analyze command parameters
The--target-table-name SalesBackupmeans the restored data goes into a new table named SalesBackup.Final Answer:
A new table named SalesBackup will be created with data from May 1, 2024, 12:00 UTC -> Option AQuick Check:
Restore creates new table = SalesBackup [OK]
- Thinking restore overwrites original table
- Confusing backup with restore commands
- Assuming restore-date-time format is invalid
aws dynamodb restore-table-to-point-in-time --source-table-name Inventory --target-table-name Inventory --restore-date-time 1704067200
But it fails with an error. What is the likely cause?
Solution
Step 1: Check restore-table-to-point-in-time requirements
The target table name must be unique and cannot be the same as the source table.Step 2: Analyze the command error cause
Using the same name for source and target causes a conflict and failure.Final Answer:
The target table name must be different from the source table name -> Option BQuick Check:
Target table name ≠ source table name [OK]
- Assuming restore overwrites existing table
- Overlooking that PITR must be enabled on the source table
- Blaming AWS CLI version without checking names
Users 10 days ago. Today, you want to restore it to the state exactly 40 days ago. What will happen if you try to restore using PITR?Solution
Step 1: Recall PITR retention period
PITR supports restoring data only within the last 35 days from the current time.Step 2: Analyze restore request for 40 days ago
Requesting restore beyond 35 days is outside PITR limits and will cause failure.Final Answer:
The restore will fail because PITR only supports recovery up to 35 days in the past -> Option AQuick Check:
PITR limit = 35 days; 40 days restore fails [OK]
- Assuming PITR can restore beyond 35 days
- Thinking restore auto-adjusts to closest backup
- Confusing PITR with manual snapshot backups
Ready to prove it?
Pass the test and this pattern moves unknown
