Processing input and output in Step Functions - AWS Step Functions

Processing input and output in Step Functions

Understanding how data flows from state to state in a AWS Step Functions workflows, and learning how to filter and manipulate this data, is key to effectively designing and implementing workflows in AWS Step Functions.

A Step Functions execution receives a JSON text as input and passes that input to the first state in the workflow. Individual states receive JSON as input and usually pass JSON as output to the next state.

In the Amazon States Language, these fields filter and control the flow of JSON from state to state:

  • InputPath

  • Parameters

  • ResultSelector

  • ResultPath

  • OutputPath

The following diagram shows how JSON information moves through a task state. InputPath selects which parts of the JSON input to pass to the task of the Task state (for example, an AWS Lambda function). ResultPath then selects what combination of the state input and the task result to pass to the output. OutputPath can filter the JSON output to further limit the information that's passed to the output.

Order of filters: InputPath, Parameters, ResultSelector, ResultPath, and OutputPath.

InputPath, Parameters, ResultSelector, ResultPath, and OutputPath each manipulate JSON as it moves through each state in your workflow.

Each can use paths to select portions of the JSON from the input or the result. A path is a string, beginning with $, that identifies nodes within JSON text. Step Functions paths use JsonPath syntax.

Tip

To deploy an example of a workflow that includes input and output processing to your AWS account, see Module 6 - Input and Output Processing of The AWS Step Functions Workshop.