Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon CLI, route 53, TXT error

I'm trying to create a TXT record in Route53 via the Amazon CLI for DNS-01 validation. Seems like I'm very close but possibly running into a CLI issue (or a formatting issue I don't see). As you can see, it's complaining about a value that should be in quotes, but is indeed in quotes already...

Command Line:

aws route53 change-resource-record-sets --hosted-zone-id ID_HERE --change-batch file://c:\dev\test1.json

JSON File:

{
"Changes": [
    {
        "Action": "UPSERT",
        "ResourceRecordSet": {
            "Name": "DOMAIN_NAME_HERE",
            "Type": "TXT",
            "TTL": 60,
            "ResourceRecords": [
                {
                    "Value": "test"
                }
            ]
        }
    }
]
}

Error:

An error occurred (InvalidChangeBatch) when calling the ChangeResourceRecordSets operation: Invalid Resource Record: FATAL problem: InvalidCharacterString (Value should be enclosed in quotation marks) encountered with 'test'
like image 746
BRass Avatar asked Nov 21 '16 23:11

BRass


1 Answers

Those quotes are the JSON quotes, and those are not the quotes they're looking for.

The JSON string "test" encodes the literal value test.

The JSON string "\"test\"" encodes the literal value "test".

(This is because in JSON, a literal " in a string is escaped with a leading \).

It sounds like they want actual, literal quotes included inside the value, so if you're building this JSON manually you probably want the latter: "Value": "\"test\"".

A JSON library should do this for you if you passed it the value with the leading and trailing " included.

like image 198
Michael - sqlbot Avatar answered Oct 23 '22 10:10

Michael - sqlbot