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

0

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.

Thanks!

已提問 2 年前檢視次數 4354 次
2 個答案
1

Hello,

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!

Regards,

Carl Östrand

profile picture
已回答 2 年前
-1

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- https://awscli.amazonaws.com/v2/documentation/api/latest/reference/stepfunctions/start-execution.html -- [1]

profile pictureAWS
支援工程師
已回答 2 年前
profile pictureAWS
專家
Uri
已審閱 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南