![Programmatically backup your Amazon Route53 zones deployed via AWS CDK](https://assets.community.aws/a/2dR6YvJOAc3FdoFgKFN5Ms9mfvL/aws_.webp)
Programmatically backup your Amazon Route53 zones deployed via AWS CDK
An easy, scheduled way to backup your Amazon Route53 public and private forward hosted zones!
Published Mar 9, 2024
Looking for an easy way to backup your
Amazon Route53
records to Amazon S3
with proper lifecycle rules and retention? Look no further, as we cover how to deploy this solution using AWS CDK!For those that have been following this project, I've just updated it with the ability to distinguish between public and private hosted zones! This appends
_public
or _private
to the objects stored.Per the usual, I maintain the codebase here: https://github.com/troydieter/r53_backups_cdk
AWS-CDK
(CLI) v2.x can be sourced from herePython3
andpip3
- Existing
Amazon Route53
zones (public or private) - Sufficient permissions to deploy the resources and grant the
AWS Lambda
role the managed policy:AmazonRoute53ReadOnlyAccess
- Retrieve the code-base using
git clone
(see above for GitHub URL) python -m venv .venv
pip install -r ./requirements.txt
cdk synth
cdk deploy
![Diagram](https://assets.community.aws/a/2dR7O44jAXHIhdWQZJHEx5Dr0UV/diag.webp)
- This Amazon S3 Bucket, which you’ll see as
R53BackupBucket-XXX
as a Logical ID in CloudFormation will be the Amazon S3 bucket in which all the records are saved. They will be time delimited, as shown. - The timestamped directory will house each one of the
Amazon Route53
zones that it backed up. Public or Private will be appended to the Route53 forward hosted zones. - Digging deeper, if you explore one of the directories (a forward zone, for example
troydieter.com/
- If you retrieve one of these files (in this case, the
troydieter.com.csv
file) the following is shown.
Considering this solution utilizes largely event-driven architecture, the cost is fractions of a
USD
penny to operate monthly.This solution provides the ability to backup Amazon Route 53 hosted zones. By backing up hosted zones, it allows users to keep a record of their DNS configurations, and enables easy restoration in case of data loss or corruption. This can provide business value by reducing downtime and data loss, and improving disaster recovery time, which can help protect the availability and reliability of an organization’s online assets.