Error (InvalidChangeBatch) in adding multiple DNS Records from aws command line

╄→尐↘猪︶ㄣ 提交于 2020-08-10 05:01:10

问题


I am trying to add multiple DNS records using this script add_multipleDNSrecord.sh and i am getting this error

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

But i am able to add single record without any issue from aws cli. can anyone please tell me what went wrong in this script?

#!/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:


After Replacing the space and using dot instead of space solves the problem.

Now,The script works fine and its able to add multiple records to the hosted zone.



来源:https://stackoverflow.com/questions/37513831/error-invalidchangebatch-in-adding-multiple-dns-records-from-aws-command-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!