logo
Menu
Programmatically backup your Amazon Route53 zones deployed via AWS CDK

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

Programmatically backup your Amazon Route53 zones

Overview

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.

Deployment

Code

Per the usual, I maintain the codebase here: https://github.com/troydieter/r53_backups_cdk

Requirements

  1. AWS-CDK (CLI) v2.x can be sourced from here
  2. Python3 and pip3
  3. Existing Amazon Route53 zones (public or private)
  4. Sufficient permissions to deploy the resources and grant the AWS Lambda role the managed policy: AmazonRoute53ReadOnlyAccess

Deployment Overview

  1. Retrieve the code-base using git clone (see above for GitHub URL)
  2. python -m venv .venv
  3. pip install -r ./requirements.txt
  4. cdk synth
  5. cdk deploy

Deployment Diagram

Diagram

Outputs

Amazon S3 Bucket

  1. 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.
    dirlistings
  2. 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.
  3. Digging deeper, if you explore one of the directories (a forward zone, for example troydieter.com/
  4. If you retrieve one of these files (in this case, the troydieter.com.csv file) the following is shown.

Operating Cost

Considering this solution utilizes largely event-driven architecture, the cost is fractions of a USD penny to operate monthly.

Recap

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.
 

Comments