0
0
DynamoDBquery~5 mins

Point-in-time recovery (PITR) in DynamoDB

Choose your learning style9 modes available
Introduction

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.

You accidentally delete important data and want to get it back.
You want to recover your database to a state before a software bug caused wrong data.
You want to protect your data from unexpected errors or attacks.
You want to test how your application worked at a specific past time.
You want to meet compliance rules that require data recovery options.
Syntax
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.

Examples
This command turns on PITR for the table named MusicCollection.
DynamoDB
aws dynamodb update-continuous-backups --table-name MusicCollection --point-in-time-recovery-specification PointInTimeRecoveryEnabled=true
This command creates a new table MusicCollectionBackup restored to May 1, 2024, at noon UTC.
DynamoDB
aws dynamodb restore-table-to-point-in-time --source-table-name MusicCollection --target-table-name MusicCollectionBackup --restore-date-time 2024-05-01T12:00:00Z
Sample Program

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.

DynamoDB
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
OutputSuccess
Important Notes

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.

Summary

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.