- Newest
- Most votes
- Most comments
I believe this can be done by importing the zone file into Route53 as per the following document.
However, please be careful to work with the zone file format, etc.
Supported formats and notes are listed in the documentation.
https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/resource-record-sets-creating-import.html
The zone file must be in RFC-compliant format.
The domain name of the records in the zone file must match the name of the hosted zone.
Route 53 supports the $ORIGIN and $TTL keywords. If the zone file includes $GENERATE or $INCLUDE keywords, the import fails and Route 53 returns an error.
When you import the zone file, Route 53 ignores the SOA record in the zone file. Route 53 also ignores any NS records that have the same name as the hosted zone.
You can import a maximum of 1000 records. If you need to import more than 1000 records, you might be able to use the BIND to Amazon Route 53 Conversion Tool.
If the hosted zone already contains records that appear in the zone file, the import process fails, and no records are created.
We recommend that you review the contents of the zone file to confirm that record names include or exclude a trailing dot as appropriate:
When the name of a record in the zone file includes a trailing dot (example.com.), the import process interprets the name as a fully qualified domain name and creates a Route 53 record with that name.
When the name of a record in the zone file does not include a trailing dot (www), the import process concatenates that name with the domain name in the zone file (example.com) and creates a Route 53 record with the concatenated name (www.example.com).
If the export process doesn't add a trailing dot to the fully qualified domain names of a record, the Route 53 import process adds the domain name to the name of the record. For example, suppose you're importing records into the hosted zone example.com and the name of an MX record in the zone file is mail.example.com, with no trailing dot. The Route 53 import process creates an MX record named mail.example.com.example.com.
I would be looking at using IaC, infrastructure as code for tasks such as this.
Personally I use terraform and you could have a module that does exactly this.
https://stackoverflow.com/questions/61398659/bulk-record-generation-in-aws-route53-hosted-zone-with-terraform https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/resource-record-sets-creating-import.html
You can import or se terraform to automate tasks also by using Terraform yu can gain lost of automation capabilities additionally.
Terraform does not natively support bulk record generation in AWS Route53 hosted zones. However, one approach recommended on Stack Overflow is to export your records to JSON, transform them using a tool like jq or others to get a list of records that you could then transform using tools like json2hcl, and feed the result into a Terraform module that takes records as a list. A user shared their experience using this method to migrate multiple domains with hundreds of records each from Digital Ocean to AWS with minimal manual work.
AWS Route 53 allows you to create records by importing a zone file, which uses a standard format known as BIND to represent records in a text format. This process requires that the zone file is in RFC-compliant format and that the domain name of the records in the zone file matches the name of the hosted zone. There are certain restrictions such as a maximum import limit of 1000 records and ignoring of some record types like SOA and NS that have the same name as the hosted zone. If the hosted zone already contains records that appear in the zone file, the import process will fail and no records will be created. Also, be careful with the handling of trailing dots in the record names, as the import process will treat names differently based on whether they include a trailing dot or not.
Relevant content
- asked 2 months ago
- asked 6 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 9 months ago
Hi @Riku_Kobayashi thanks for the response. I want the A record to be replicate automatically in another hosted zones , the issue is whenever we create a new webserver one more A record has to be entered and it need to replicate into all other hosted zone automatically but importing the zone file in to Route53 it will be a manual activity each time right!!
For example, but I thought that if I could create a script that runs change_resource_record_sets using Python Boto3, I could automate the creation of A records. https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/route53/client/change_resource_record_sets.html