Configure a DNS record set change-resource-record-sets — AWS CLI 1.15.35 Command Reference

Visits: 5611

To list your resources

aws route53 list-hosted-zones

aws route53 list-resource-record-sets –hosted-zone-id BLABLALA –query “ResourceRecordSets[?Name == ‘example.domain.’]”

Use this output as the base for rebuilding the input Json file.

You can write a Jason File to input into this

aws route53 change-resource-record-sets --cli-input-json

--cli-input-json (string) Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, the CLI values will override the JSON-provided values.

{
  "Comment": "string",
  "Changes": [
    {
      "Action": "CREATE"|"DELETE"|"UPSERT",
      "ResourceRecordSet": {
        "Name": "string",
        "Type": "SOA"|"A"|"TXT"|"NS"|"CNAME"|"MX"|"NAPTR"|"PTR"|"SRV"|"SPF"|"AAAA"|"CAA",
        "SetIdentifier": "string",
        "Weight": long,
        "Region": "us-east-1"|"us-east-2"|"us-west-1"|"us-west-2"|"ca-central-1"|"eu-west-1"|"eu-west-2"|"eu-west-3"|"eu-central-1"|"ap-southeast-1"|"ap-southeast-2"|"ap-northeast-1"|"ap-northeast-2"|"ap-northeast-3"|"sa-east-1"|"cn-north-1"|"cn-northwest-1"|"ap-south-1",
        "GeoLocation": {
          "ContinentCode": "string",
          "CountryCode": "string",
          "SubdivisionCode": "string"
        },
        "Failover": "PRIMARY"|"SECONDARY",
        "MultiValueAnswer": true|false,
        "TTL": long,
        "ResourceRecords": [
          {
            "Value": "string"
          }
          ...
        ],
        "AliasTarget": {
          "HostedZoneId": "string",
          "DNSName": "string",
          "EvaluateTargetHealth": true|false
        },
        "HealthCheckId": "string",
        "TrafficPolicyInstanceId": "string"
      }
    }
    ...
  ]
}

 

For a good guide Also see: https://oliverhelm.me/sys-admin/updating-aws-dns-records-from-cli

 

Source: change-resource-record-sets — AWS CLI 1.15.35 Command Reference Lots more samples with Jsons are there too….

With Node.js you can automate updating route53, see:

https://blog.powerupcloud.com/automate-updating-thousands-of-record-sets-in-route53-using-nodejs-1737883927a0

 

Leave a Reply