Map State

AWS Step Functions workflows support a Map state that allows you to run a sub-workflow independently against each item in a JSON array in the state input.

To configure a Map state, you define an Iterator, which is a complete sub-workflow. When a Step Functions execution enters a Map state, it applies the Iterator to each item in an array, potentially in parallel. When all sub-workflow executions complete, the Map state returns an array containing the output for each item processed by the Iterator.

Typical cases

A Map state should be considered if you need to apply entire sub-workflows to a collection of items where the exact number of items to be processed cannot be known at build time.

For example, if you wanted to process a checkout event on an e-commerce site, you might want to run a “pick and reserve” sub-workflow against each individual item to ensure that you have sufficient quantities on hand.

A screen capture of a flowchart depicting dynamic parallelism in an AWS Step Functions workflow

Dynamic parallelism

For additional information on the Map State, see the launch announcement and the documentation.