Search code examples
amazon-web-servicesaws-cliaws-step-functions

AWS CLI - Get error in create-state-machine --definition


I have a file that I exported from a Step Function in JSON format, and I made some modifications. I'm trying to create another Step Function using the AWS CLI, but I always receive an error:

Command:
aws stepfunctions create-state-machine --name 'firstStep' --definition .\CriarContaFaturamento-PrimeiraEtapa.asl.json --role-arn arn:aws:iam::xxxxxxxxxxxxx:role/aws-stepfunctions-xxxxxxx-dev-default --profile xxx --region us-east-1
Error:
An error occurred (InvalidDefinition) when calling the CreateStateMachine operation: Invalid State Machine Definition: 'INVALID_JSON_DESCRIPTION: Unexpected character ('.' (code 46)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
 at [Source: (String)".\CriarContaFaturamento-PrimeiraEtapa.asl.json"; line: 1, column: 2] at [Source: (String)".\CriarContaFaturamento-PrimeiraEtapa.asl.json"; line: 1, column: 2]'

Do you know what might be wrong with the definition and what I could do to resolve it? Im using powershell, but i tried in CMD and i got the same error.


Solution

  • Unexpected character '.' suggests me the command line didn't parse your .\CriarContaFaturamento-PrimeiraEtapa.asl.json instruction. Have your tried something like:

    $ aws stepfunctions create-state-machine --name 'state-machine-name' --definition file://CriarContaFaturamento-PrimeiraEtapa.asl.json --role-arn arn:aws:iam::xxxxxxxxxxxxx:role/aws-stepfunctions-xxxxxxx-dev-default --profile xxx --region us-east-1