Loading...

How to backup the AWS Route53 DNS automatically

Last updated: Dec 25th 2024

To Backup Route53 DNS configurations automatically regularly, we recommend using S3 storage as a destinatino for backups, format csv and json, lambda serverless function as the script that performs the backup and the EventBridge to trigger. 

  1. First, Create a S3 private bucket as the destination for the backups.
    From S3 --> Create bucket --> Bucket name "route53backup" --> region "us-east-2" --> create bucket
  2. Create the Lambda function. 
    From Lambda --> Create function --> Function name -->Runtime "Python 3.8" --> Create function --> under code paste the code from the attached "aws_s3_route53.py" --> deploy --> configuration --> Permission --> Execution role "Edit" --> choose a new role
    Please note When you open the code you will need to update two variables:
    s3_bucket_name = ''   ----> between '' please enter you S3 bucket that created in step 1, my case was route53backup_awssupport
    s3_bucket_region = '' ----> between '' please enter you S3 bucket region that created in step 1, my case was us-east-2
    If you have too many hosted zones, you might also have to increase the memory limit and timeout to ensure that the lambda function runs across on all the hosted zones. 
  3. Update the new role that would have been created after the lambda function is created to add the required permissions to access the S3 bucket and the Route53 hosted zones.
  4. Create a Eventbridge event for every 1 hour (or desired recurring duration).
    From AWS Eventbridge --> Events --> Rules --> choose Schedule --> choose 'A schedule that runs at a regular rate, such as every 10 minutes' --> then update the Rate as per your use case --> Next --> Target types "AWS service" --> Then choose Lambda function --> Function " choose the one that created in step 3 --> next
  5. Check the S3 bucket for your backups and verify.
  6. You might also want to update the S3 bucket to remove the older backups to save space

Hope this helps. 

SYED ABDUL QUADER Published on 28 Mar 2022
Edit
Comments
Guest User