从aws命令行添加多个DNS记录时出错(InvalidChangeBatch)

时间:2016-05-29 19:08:59

标签: amazon-web-services command-line-interface amazon-route53

我正在尝试使用此脚本add_multipleDNSrecord.sh添加多个DNS记录,我收到此错误

A client error (InvalidChangeBatch) occurred when calling the ChangeResourceRecordSets operation: FATAL problem: UnsupportedCharacter (Value contains unsupported characters) encountered with ' '

但是我可以添加单个记录而没有来自aws cli的任何问题。谁能告诉我这个剧本出了什么问题?

#!/bin/bash
# declare STRING variable
STRING="Hello World"
#print variable on a screen
echo $STRING

# Hosted Zone ID
ZONEID="Z24*************"


#Comment
COMMENT="Add new entry to the zone"

# The Time-To-Live of this recordset
TTL=300

# Type
TYPE="A"

# Input File Name
FILENAME=/home/ec2-user/awscli/route53/scripts/test.json



cat >> $FILENAME << EOF
    {
      "Comment":"$COMMENT",
      "Changes":[
        {
          "Action":"CREATE",
          "ResourceRecordSet":{
            "ResourceRecords":[
              {
                "Value":"$IP"
              }
            ],
            "Name":"$RECORDSET",
            "Type":"$TYPE",
            "TTL":$TTL
          }
        }
      ]
    }
EOF

echo $FILENAME

1 个答案:

答案 0 :(得分:0)

更换空间后使用点而不是空格解决问题。

现在,该脚本运行正常,并且能够将多个记录添加到托管区域。