How to delete a DNS record in Route53 via aws cli?

Viewed 6021

I am using aws cli to create and delete DNS record in Route 53. I am not sure about the payload or the command that has to be used. As per this link, I created this payload, but it's not working. The payload is

{
"Comment": "Delete single record set",
"Changes": [
    {
        "Action": "DELETE",
        "ResourceRecordSet": {
            "Name": "$DNS_NAME.",
            "Type": "$RECORD_TYPE",
            "TTL": $TTL,
            "ResourceRecords": [
                {
                    "Value": "${RESOURCE_VALUE}"
                }
            ]                
        }
    }
]

}

which I handled in a variable called payload And the AWS cli command is

aws route53 change-resource-record-sets --hosted-zone-id ${HOSTED_ZONE_ID} --change-batch payload

Any idea what I am doing wrong? Can anyone please confirm if the command and the payload is correct?

1 Answers

Save the payload into a json file and Input the filename. Use file:// protocol to refer the payload path.

aws route53 change-resource-record-sets --hosted-zone-id ZSDAGFDG35GS --change-batch file://tmp/payload.json
Related