I would like to export a DNS zonefile from my Amazon Route 53 setup. Is this possible, or can zonefiles only be created manually? (e.g. through http://www.zonefile.org/?lang=en)
Add a CNAME Record to Your Amazon Route 53 Hosted DomainOnce logged in, click the hamburger menu icon on the left-hand side, and menu options will appear. Select Hosted zones from the left-hand side menu option. Select the domain name that you'd like to update with a CNAME record.
Route 53 provides an extension to DNS functionality known as alias records. Similar to CNAME records, alias records let you route traffic to selected AWS resources, such as CloudFront distributions and Amazon S3 buckets.
The following script exports zone details in bind format from Route53. Pass over the domain name as a parameter to script. (This required awscli to be installed and configured.)
#!/bin/bash zonename=$1 hostedzoneid=$(aws route53 list-hosted-zones --output json | jq -r ".HostedZones[] | select(.Name == \"$zonename.\") | .Id" | cut -d'/' -f3) aws route53 list-resource-record-sets --hosted-zone-id $hostedzoneid --output json | jq -jr '.ResourceRecordSets[] | "\(.Name) \t\(.TTL) \t\(.Type) \t\(.ResourceRecords[]?.Value)\n"'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With