ItemSelector - Amazon Step Functions
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).


By default, the effective input for the Map state is the set of individual data items present in the raw state input. The ItemSelector field lets you override the data items’ values before they’re passed on to the Map state. To override the values, specify a valid JSON input that contains a collection of key-value pairs. These pairs can be static values provided in your state machine definition, values selected from the state input using a path, or values accessed from the context object.

If you specify key-value pairs using a path or context object, the key name must end in .$.


The ItemSelector field replaces the Parameters field within the Map state. If you use the Parameters field in your Map state definitions to create custom input, we highly recommend that you replace them with ItemSelector.

You can specify the ItemSelector field in both an Inline Map state and a Distributed Map state.

For example, consider the following JSON input that contains an array of three items within the imageData node. For each Map state iteration, an array item is passed to the iteration as input.

[ { "resize": "true", "format": "jpg" }, { "resize": "false", "format": "png" }, { "resize": "true", "format": "jpg" } ]

Using the ItemSelector field, you can define a custom JSON input to override the original input as shown in the following example. Step Functions then passes this custom input to each Map state iteration. The custom input contains a static value for size and the value of a context object data for Map state. The $$.Map.Item.Value context object contains the value of each individual data item.

{ "ItemSelector": { "size": 10, "value.$": "$$.Map.Item.Value" } }

The following example shows the input received by one iteration of the Inline Map state:

{ "size": 10, "value": { "resize": "true", "format": "jpg" } }

For a complete example of a Distributed Map state that uses the ItemSelector field, see Getting started with using Distributed Map state.