Description
DynamoDB point-in-time recovery (PITR) restores a new table from the time you choose in the available window. Use it to recover from a bad write or accidental deletion.
Potential impact
If PITR was off at the time, you may need another backup or a manual repair.
Remediation
Set enabled = true in the table’s point_in_time_recovery block. Check the earliest and latest restorable times. Test restoring the table, reapplying required settings such as access policies, and switching the application to it. Plan separate backups for longer retention.
Examples
The examples change only PITR on orders. You can restore only to times after you enabled it and within the retention window.
Before
hcl
resource "aws_dynamodb_table" "orders" {
name = "orders"
billing_mode = "PAY_PER_REQUEST"
hash_key = "id"
attribute {
name = "id"
type = "S"
}
point_in_time_recovery {
enabled = false
}
}
After
hcl
resource "aws_dynamodb_table" "orders" {
name = "orders"
billing_mode = "PAY_PER_REQUEST"
hash_key = "id"
attribute {
name = "id"
type = "S"
}
point_in_time_recovery {
enabled = true
}
}