Follow dba-ninja.com

Subscribe to RSS feed  Follow @jackvamvas - Twitter

*Use the Comments section for questions

dba-ninja.com Links

Dba_db2_button

Sqlserver_dba_button

Recover deleted DynamoDB table with Point-In-Time Recovery Enabled

20 February,2024 by Rambler

Question: I have accidentally deleted a DynamoDB table that had Point in Time Recovery (PITR) enabled. Is it possible to recover this DynamoDB table ?

Answer: It is possible to recover a DynamoDB table that had  PITR enabled. As per AWS documentation :

When you delete a table that has point-in-time recovery enabled, DynamoDB automatically creates a backup snapshot called a system backup and retains it for 35 days (at no additional cost). You can use the system backup to restore the deleted table to the state it was in just before deletion. All system backups follow a standard naming convention of table-name$DeletedTableBackup.

Once a table with point-in-time recovery enabled is deleted, you can use system restore to restore that table to a single point in time: the moment just before deletion. You do not have the capability to restore a deleted table to any other point in time in the past 35 days.

As an example I have a DynamoDB table called Music

 

--confirm the DynamoDB table Music is PITR enabled 
aws dynamodb describe-continuous-backups --table-name Music --output table
------------------------------------------------------------------------
|                       DescribeContinuousBackups                      |
+----------------------------------------------------------------------+
||                    ContinuousBackupsDescription                    ||
|+------------------------------------------------+-------------------+|
||  ContinuousBackupsStatus                       |  ENABLED          ||
|+------------------------------------------------+-------------------+|
|||                  PointInTimeRecoveryDescription                  |||
||+-----------------------------+------------------------------------+||
|||  EarliestRestorableDateTime |  2024-01-16T08:59:27.675000+00:00  |||
|||  LatestRestorableDateTime   |  2024-02-20T08:54:27.675000+00:00  |||
|||  PointInTimeRecoveryStatus  |  ENABLED                           |||
||+-----------------------------+------------------------------------+||


--check there isn't already a SYSTEM backup DynamoDB backup for the Music table

aws dynamodb list-backups --table-name Music --backup-type SYSTEM --output table
-------------
|ListBackups|
+-----------+ --delete the DynamoDB table aws dynamodb delete-table --table-name Music



--check after the delete for a SYSTEM backup for the DynamoDB table
aws dynamodb list-backups --table-name Music --backup-type SYSTEM --output table
--------------------------------------------------------------------------------------------------------------------
| ListBackups |
+------------------------------------------------------------------------------------------------------------------+
|| BackupSummaries ||
|+------------------------+---------------------------------------------------------------------------------------+|
|| BackupArn | arn:aws:dynamodb:us-east-1:xxxxxxxxxxxxxx:table/Music/backup/017084567830-00000000 ||
|| BackupCreationDateTime| 2024-02-20T09:10:21.330000+00:00 ||
|| BackupExpiryDateTime | 2024-03-26T09:10:21.330000+00:00 ||
|| BackupName | Music$DeletedTableBackup ||
|| BackupSizeBytes | 143 ||
|| BackupStatus | AVAILABLE ||
|| BackupType | SYSTEM ||
|| TableArn | arn:aws:dynamodb:us-east-1:xxxxxxxxxxxx:table/Music ||
|| TableId | dd767890-5eb5-4c71-af1e-00b09e2c920c ||
|| TableName | Music ||
|+------------------------+---------------------------------------------------------------------------------------+|

 

Notice the system generated BackupName - Music$DeletedTableBackup

If reqiured proceed with a DynamoDB restore   - use commands on Amazon DynamoDB Backup & Restore

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/PointInTimeRecovery_Howitworks.html


Author: Rambler (http://www.dba-ninja.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on Recover deleted DynamoDB table with Point-In-Time Recovery Enabled


dba-ninja.com