Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error on using aws change-resource-record-sets to add an alias

I am trying to use aws change-resource-record-sets to add an alias. The idea is to allow access to a Cloudfront distribution via URL on our domain (e.g. mydomainname.mycompany.co.uk rather than mydomainname.cloudfront.net where mydomainname=something like d4dzc6m38sq0mk)

After working through various other JSON errors, which I solved, I am still getting a problem.

A client error (InvalidChangeBatch) occurred: RRSet with DNS name 
mydomainname.cloudfront.net. is not permitted in zone mycompany.co.uk.

What have I got wrong?

JSON:

{
  "Comment": "Recordset for mydomainname",
  "Changes": [
    {
      "Action": "CREATE",
      "ResourceRecordSet": {
        "Name": "mydomainname",
        "Type": "A",
        "AliasTarget": {
          "HostedZoneId": "Z2FDTNDATAQYW2",
          "DNSName": "mydomainname.cloudfront.net.",
          "EvaluateTargetHealth": false
        }
      }
    }
  ]
}

EDITED to clarify the HostedZoneID.

like image 612
kpollock Avatar asked Nov 12 '13 16:11

kpollock


1 Answers

You need to pass complete name in the NAME parameter. for your example you need to pass this:

"Name" : "mydomainname.cloudfront.net."
like image 182
user2519949 Avatar answered Nov 15 '22 07:11

user2519949