在Step Function的状态机定义中,确保每个状态都有明确定义的输入、输出和转换。其中,输入和输出应该严格匹配,否则会导致无法创建精确的工作流。
示例代码:
{ "Comment": "A sample AWS Step Functions state machine", "StartAt": "ExampleState1", "States": { "ExampleState1": { "Type": "Task", "Resource": "arn:aws:lambda:us-west-2:123456789012:function:ExampleFunction", "InputPath": "$.exampleInput", "OutputPath": "$.exampleOutput", "ResultPath": "$.exampleResult", "Next": "ExampleState2" }, "ExampleState2": { "Type": "Pass", "Result": {}, "ResultPath": "$.exampleResult", "Next": "ExampleState3" }, "ExampleState3": { "Type": "Task", "Resource": "arn:aws:lambda:us-west-2:123456789012:function:ExampleFunction", "InputPath": "$.exampleInput", "OutputPath": "$.exampleOutput", "ResultPath": "$.exampleResult", "End": true } } }
下一篇:AWS步函数状态转换失败。