AWS Backup restore testing validated by AWS Step Functions

AWS Backup Restore test → Amazon EventBridge Rule → AWS Step Functions Validation → Amazon DynamoDB Restored table

Amazon EventBridge starts an AWS Step Functions workflow when an AWS Backup restore test completes. It checks the restored Amazon DynamoDB table and reports to AWS Backup.

This pattern deploys an AWS Backup restore testing plan for an Amazon DynamoDB table and an AWS Step Functions workflow that validates each restored copy. AWS Backup restores the latest recovery point on a schedule, and checking the restored data is left to you.
When the restore job completes, an Amazon EventBridge rule starts the state machine. It takes the restored table name from the event, counts the items with a dynamodb:Scan SDK integration (Select COUNT, Limit 3) and calls the AWS Backup PutRestoreValidationResult API once with SUCCESSFUL or FAILED, so the result appears on the restore job. There's no AWS Lambda function.
The plan runs every day at the cron time while the stack exists. Each run restores the latest recovery point from the last day, so after the one-off backup in the README expires, the plan finds nothing to restore.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/backup-sfn/typescript/cdk

Deploy

npm installIf this account and Region have never been used with the AWS CDK, run npx cdk bootstrap once.CRON=$(node -e 'const d=new Date(Date.now()+30*60000);console.log(`cron(${d.getUTCMinutes()} ${d.getUTCHours()} * * ? *)`)')npx cdk deploy -c restoreTestCron="$CRON"


Testing

Put a few items into the table, take an on-demand backup with aws backup start-backup-job, then wait for the restore test to start. The plan has no run-now call: it starts at a random time within one hour after the cron time, so plan for about two hours.
Check the result with aws backup describe-restore-job. Expected: a ValidationStatus of SUCCESSFUL and a message with the restored table name.
See the GitHub repo for the exact commands, a check of the wiring that does not need to wait, and the expected output.

Cleanup

Delete the recovery points in the vault first, because a vault that holds recovery points cannot be deleted. The GitHub repo has the commands.
Delete the stack: npx cdk destroy.

Created by:

Nithin Chandran R

Nithin Chandran R

Technical Account Manager at AWS