Question:
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.
1 2 3 |
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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
{ "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.
Answer:
You need to pass complete name in the NAME
parameter. for your example you need to pass this:
1 2 |
"Name" : "mydomainname.cloudfront.net." |