使用 `change-resource-record-sets` 创建 AWS A 记录:带 DNS 名称 domain.com 的 RRSet。在区域 \047domain 中是不允许的。com7

Creating AWS A record using `change-resource-record-sets`: RRSet with DNS name domain.com. is not permitted in zone \047domain.com\047

我有以下代码:

  project_record_batch='{
    "Comment": "Testing creating a record set",
    "Changes": [{
      "Action": "CREATE",
      "ResourceRecordSet": {
        "Name": "domain.com",
        "Type": "A",
        "TTL": 120,
        "ResourceRecords": [ { "Value": "18.xxx.xxx.xxx" } ]
      }
    }]
  }'

  aws route53 change-resource-record-sets \
    --hosted-zone-id "/hostedzone/Z..." \
    --change-batch "${project_record_batch}"
    --region eu-west-2

它returns以下错误:

An error occurred (InvalidChangeBatch) when calling the ChangeResourceRecordSets operation: 
[RRSet with DNS name domain.com. is not permitted in zone 7domain.com7.]

我试过:

我做错了什么?


也刚刚尝试了以下批处理负载:

project_record_batch='{
     "Comment": "Testing creating a record set",
     "Changes": [{
       "Action": "CREATE",
       "ResourceRecordSet": {
         "Name": "domain.com.",
         "Type": "A",
         "AliasTarget": { 
            "HostedZoneId": "Z...",
            "DNSName": "18.xxx.xxx.xxx",
            "EvaluateTargetHealth": false
         }
       }
     }]
   }'

给出了以下内容:

An error occurred (InvalidChangeBatch) when calling the 
ChangeResourceRecordSets operation: [Tried to create an alias that 
targets 18.xxx.xxx.xxx., type A in zone Z..., 
but the alias target name does not lie within the target zone, 
Tried to create an alias that targets 18.xxx.xxx.xxx., type A in 
zone Z..., but that target was not found, RRSet 
with DNS name domain.com. is not permitted in zone 
\domain.com7.]

事实证明,在以编程方式创建 DNS 托管区域时,我错误地引用了域名变量,因此出现了奇怪的 7 东西,它是一个 ASCII 反斜杠字符代码,可能是为了转义上面所说的引号AWS 服务器端。它最终以 'domain.com' 而不是 domain.com 的形式出现。这似乎给其他命令带来了很多麻烦。

tl;dr 确保您在使用 aws cli

时不会被 shell 引用问题所困扰