4

I am trying to update crawler using this command:

aws glue update-crawler --name my-crawler --configuration '{"Version":1.0,"CrawlerOutput":{"Partitions":{"AddOrUpdateBehavior":"InheritFromTable"}}}' --region us-west-2

As described here

Instead of update I got:

An error occurred (InvalidInputException) when calling the UpdateCrawler operation: Crawler configuration not valid: Error parsing JSON: Received JsonParseException: Unexpected character (''' (code 39)): expected a valid value (number, String, array, object, 'true', 'false' or 'null'). Check that your JSON is well formed. For more information about the crawler configuration structure, see http://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-crawler-crawling.html.

The jsonlint tells me that json is ok.

What is wrong? How pass json as parameter for aws cli?

cli is used under windows 10

Cherry
  • 31,309
  • 66
  • 224
  • 364
  • Try this `aws glue update-crawler --name my-crawler --configuration {"Version":1.0,"CrawlerOutput":{"Partitions":{"AddOrUpdateBehavior":"InheritFromTable"}}} --region us-west-2` – Sailesh Kotha Feb 15 '18 at 15:44
  • `Received JsonParseException: Unexpected character ('V' (code 86)): was expecting double-quote to start field name` :( – Cherry Feb 15 '18 at 15:48

2 Answers2

3

You have to escape the quotes under Windows:

aws glue update-crawler --name my-crawler --configuration "{\"Version\":1.0,\"CrawlerOutput\":{\"Partitions\":{\"AddOrUpdateBehavior\":\"InheritFromTable\"}}}" --region us-west-2
Rik Turnbull
  • 186
  • 2
1

For Windows, you have to do some "special" escaping, which I've learned the hard way. Take the following JSON snippet...

{ "#t": "timestamp" }`

Here's how you'd enter it on Windows...

DOS

aws dynamodb scan --table-name MyTable --region "us-east-1" --profile dev --projection-expression "failureKey, #t" --expression-attribute-names "{ ""#t"": ""timestamp"" }"

For Powershell, it's a little different...

Powershell

aws dynamodb scan --table-name "MyTable" --region "us-east-1" --profile "dev" --projection-expression "failureKey, #t" --expression-attribute-names '{ \"#t\": \"timestamp\" }'

Used an example with a shorter JSON snippet, but you get the idea. Apply the same concept to your string based on the shell your using.

Adam
  • 3,891
  • 3
  • 19
  • 42