Enable and Verify Point-in-Time Recovery (PITR) in DynamoDB
📖 Scenario: You are managing a DynamoDB table for a small online store. To protect against accidental data loss, you want to enable Point-in-Time Recovery (PITR) so you can restore the table to any second in the last 35 days if needed.
🎯 Goal: Enable PITR on the DynamoDB table named Orders and verify that PITR is active.
📋 What You'll Learn
Create a DynamoDB table named Orders with a primary key OrderId (string).
Enable Point-in-Time Recovery (PITR) on the Orders table.
Check and confirm that PITR is enabled on the Orders table.
💡 Why This Matters
🌍 Real World
Enabling PITR helps protect your DynamoDB tables from accidental deletes or updates by allowing you to restore data to any second in the past 35 days.
💼 Career
Database administrators and cloud engineers often enable PITR to ensure data durability and quick recovery in production environments.
Progress0 / 4 steps
1
Create the DynamoDB table Orders
Write the AWS CLI command to create a DynamoDB table named Orders with a primary key called OrderId of type string.
DynamoDB
Hint
Use aws dynamodb create-table with --table-name Orders, define OrderId as the HASH key of type string (S).
2
Enable Point-in-Time Recovery (PITR) on Orders
Write the AWS CLI command to enable Point-in-Time Recovery (PITR) on the DynamoDB table named Orders.
DynamoDB
Hint
Use aws dynamodb update-continuous-backups with --point-in-time-recovery-specification PointInTimeRecoveryEnabled=true to enable PITR.
3
Check if PITR is enabled on Orders
Write the AWS CLI command to describe the continuous backups status of the DynamoDB table named Orders to verify if PITR is enabled.
DynamoDB
Hint
Use aws dynamodb describe-continuous-backups with --table-name Orders to see if PITR is enabled.
4
Confirm PITR is active and ready
Add a command to check the table status to ensure the Orders table is active and ready for PITR.
DynamoDB
Hint
Use aws dynamodb describe-table with --table-name Orders to confirm the table is active.
Practice
(1/5)
1. What is the main purpose of Point-in-time recovery (PITR) in DynamoDB?
easy
A. To automatically delete old data after 35 days
B. To increase the read capacity of a table
C. To create backups only once a day
D. To restore a table to any second within the last 35 days
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 D
Quick Check:
PITR = Restore to any second in 35 days [OK]
Hint: PITR = restore table to any second in last 35 days [OK]
Common Mistakes:
Confusing PITR with daily backups
Thinking PITR deletes old data
Assuming PITR changes table capacity
2. Which AWS CLI command enables Point-in-time recovery (PITR) on a DynamoDB table named Orders?
easy
A. aws dynamodb restore-table-to-point-in-time --table-name Orders --enable-pitr
B. aws dynamodb enable-pitr --table Orders
C. aws dynamodb update-continuous-backups --table-name Orders --point-in-time-recovery-specification PointInTimeRecoveryStatus=ENABLED
D. aws dynamodb start-backup --table-name Orders --pitr true
Solution
Step 1: Identify correct command to enable PITR
The command to enable PITR is update-continuous-backups with 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 C
Quick Check:
Enable PITR = update-continuous-backups with PointInTimeRecoveryStatus=ENABLED [OK]
Hint: Enable PITR with update-continuous-backups and PointInTimeRecoveryStatus=ENABLED [OK]
Common Mistakes:
Using non-existent commands like enable-pitr
Confusing backup start with PITR enable
Trying to enable PITR during restore
3. Given the following AWS CLI command, what will happen?
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 B
Quick Check:
Target table name ≠ source table name [OK]
Hint: Target table name must differ from source table name [OK]
Common Mistakes:
Assuming restore overwrites existing table
Overlooking that PITR must be enabled on the source table
Blaming AWS CLI version without checking names
5. You enabled PITR on a table 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?
hard
A. The restore will fail because PITR only supports recovery up to 35 days in the past
B. The table will be restored to the closest available backup at 35 days ago
C. The table will be restored to the current state since 40 days is out of range
D. The restore will succeed and recover data from 40 days ago
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 A
Quick Check:
PITR limit = 35 days; 40 days restore fails [OK]
Hint: PITR max restore window is 35 days only [OK]
Common Mistakes:
Assuming PITR can restore beyond 35 days
Thinking restore auto-adjusts to closest backup
Confusing PITR with manual snapshot backups
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.