By using AWS re:Post, you agree to the Terms of Use

Proper syntax to start-execution with Step Functions in AWS CLI


IS there any syntax documentation for how to run Step Functions with AWS CLI, and specifically for how to start an execution.

I input the ARN, and the json input but keep getting an error that the --input argument is only expecting one argument. I was hoping someone could provide an example of the proper syntax for these parameters.


2 Answers

Hello, Attaching the link necessary for the same. Please refer the same to check for the syntax and the right options . [1]

Hope this helps !!

Link- -- [1]

answered a month ago
profile picture
reviewed a month ago


The correct syntax looks like this:

AWS stepfunctions start-execution --state-machine-arn $ARN  --input "{\"first_name\" : \"test\"}"  

I agree with you that the documentation is misleading/confusing because "input": "{\"first_name\" : \"test\"}" is not a valid JSON.

If your having issues with JSON encoding, jq can help, for example:

AWS stepfunctions start-execution --state-machine-arn $ARN --input "$(echo '{"my_key": "my_value"}' | jq -R . )" 

You can also read the input from a file:

aws stepfunctions start-execution --state-machine-arn $ARN --input "$(jq -R . input.json --raw-output)"

I hope this helps!


Carl Östrand

profile picture
answered a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions