AWS Route53 — Update records via AWS CLI

Nadav Svirsky
1 min readApr 12, 2021

Using AWS CLI 2 and depending on the avilable API, you can practicly run any task on AWS. Lately I had to update some existing records in my Route53 zone.

It required extracting the current records from the zone, manipulating a JSON file and uploading it back to Route53.

  1. To extract the list of records, run the following (replace ZXXXX with your zone ID):
aws route53 list-resource-record-sets --hosted-zone-id ZXXXXXXXXXX  --no-verify-ssl

If your a Windows user you can send the output straight to a text file with the following:

aws route53 list-resource-record-sets --hosted-zone-id ZXXXXXXXXX   --no-verify-ssl >> C:\temp\file.txt

2. The file is a JSON structured file. You need to extract the records you want to modify and build a new JSON file as can be found in this KB and in the example below:

Just make sure to enter UPSERT in actions in order it to succeed.

3. To upload the file again run the following:

aws route53 change-resource-record-sets --hosted-zone-id ZXXXXXXXXXX --no-verify-ssl --change-batch file://route53.json

--

--