Tech Enthusiast and Clouder. AWS 4x Certified. & I still watch One piece and spongebob squarepants
As we know with great power comes great responsibility, on-demand backups are the real saviour if your Dynamo DB got corrupted abruptly. Also, it helps you to meet the compliance requirements for the ages if your client keeps bothering you like your Ex. But I don't have the tenacity to initiate the Backup every day. Hence, I devise a Serverless solution for all the lazy people like me out there to automate the DynamoDB backup. Where, we can explicitly mention the backup intervals, table names and backup retention period. I have achieved this using a conjunction of AWS services like Cloudformation, Lambda and Cloudwatch.
Fact-check: Why do we even doing this, contrary by using DynamoDB point-in-time recovery (PITR) we can restore to any point in time within typically 5 minutes before the current time?
just do it (Solution Briefing)
The Cloudformation template has been used to keep the solution implementation minimalistic, refer the diagram above to know which services are being used to execute this. Here, we have used cloud watch event to trigger the lambda function at a specific interval.
Lambda function stores the python script which interact with other services to automate the use-case, also the following python script has been embedded in the Cloudformation template as an inline function code to keep the integration minimalistic. (
To check the python script,
Disclaimer: Make sure your Cloudformation stack and DynamoDB table are in the same region.
1. Navigate to cloudformation (if you are doing it for the first time click on get started and proceed) & click create stack, keep everything default and put the following URL in Amazon S3 URL & click Next.
2. In the next window, you specify the stack name for e.g DynamoDBBackup and parameters. Parameters are defined in your template and allow you to input custom values when you create or update a stack. (Click Next afterwards)
3. In step 3, keep everything default and it is advisable to add a tag for easy identification.
4. In step 4, you will review the configuration, make sure you adhere with all the instructions. Finally acknowledge, that AWS CloudFormation might create IAM resources and hit create stack , Voila!’ you just break your boredom.
IAM resources: By default, you need to create IAM resources so that the lambda function gets the following permissions to execute all the operations, you can review it under Execution role in Lambda Function.
Cost: (US East (N. Virginia))
Create your free account to unlock your custom reading experience.