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.
- 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 - 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. - 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.
- 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 - Check the S3 bucket for your backups and verify.
- You might also want to update the S3 bucket to remove the older backups to save space
Hope this helps.
Comments