Im using the CLI for AWS to create a cluster and use the parameters from a json file. Here is the CLI command string Im using:
aws emr create-cluster --name "Big Matrix Re Run 1" --ami-version 3.1.0 --steps file://Segmentgroup1.json --release-label --instance-groups InstanceGroupType=MASTER,InstanceCount=1,InstanceType=m3.xlarge InstanceGroupType=CORE,InstanceCount=2,InstanceType=m3.xlarge --auto-terminate
My json file (Segmentgroup1.json) is in the same folder in which Im running the AWS command string from, but I keep getting the following error:
No JSON object could be decoded
Based on what Ive found its not finding the json file. Any ideas?
Those same commands helpfully provide the --generate-cli-skeleton parameter to generate a file in either JSON or YAML format with all of the parameters that you can edit and fill in. Then you can run the command with the relevant --cli-input-json or --cli-input-yaml parameter and point to the filled-in file.
How to select the output format. As explained in the configuration topic, you can specify the output format in three ways: Using the output option in a named profile in the config file – The following example sets the default output format to text .
json/array. This option produces raw JSON wrapped in a JSON array. You can select these output formats by starting MySQL Shell with the --result-format= value command line option, or setting the MySQL Shell configuration option resultFormat .
Output format The value can be any of the values in the following list. If you don't specify an output format, json is used as the default. json – The output is formatted as a JSON string. yaml – The output is formatted as a YAML string.
Here is an example command that works on Windows, where the file path syntax is a little different:
aws cloudwatch put-metric-data --namespace "EC2 Memory Usage" --metric-data file://C:\Users\Joe\mycode\metric.json
I ran into the same problem under my Mac, and I found the cause is the path for the json file instead of the content of the json file. To make it right:
file://
protocol as the prefix for your pathTry something like this:
aws ecs register-task-definition --cli-input-json file://<absolute_path_to_json>/your_json.json
If you don't want to hard code the file path, you may use command like pwd
to do this:
aws ecs register-task-definition --cli-input-json file://`pwd`/your_json.json
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With