AWS Fundamentals Logo
AWS Fundamentals
L2 Construct

DistributedMap

Define a Distributed Mode Map state in the state machine. A `Map` state can be used to run a set of steps for each element of an input array. A Map state will execute the same steps for multiple entries of an array in the state input. While the Parallel state executes multiple branches of steps using the same input, a Map state will execute the same steps for multiple entries of an array in the state input. A `Map` state in `Distributed` mode will execute a child workflow for each iteration of the Map state. This serves to increase concurrency and allows for larger workloads to be run in a single state machine.

Import

import { DistributedMap } from 'aws-cdk-lib/aws-stepfunctions';

Or use the module namespace:

import * as stepfunctions from 'aws-cdk-lib/aws-stepfunctions';
// stepfunctions.DistributedMap

Properties

Configuration passed to the constructor as DistributedMapProps.

itemBatcherOptional
ItemBatcher

Specifies to process a group of items in a single child workflow execution.

Default: - No itemBatcher

itemReaderOptional
IItemReader

ItemReader. Configuration for where to read items dataset in S3 to iterate

Default: - No itemReader

labelOptional
string

Label. Unique name for the Distributed Map state added to each Map Run

Default: - No label

mapExecutionTypeOptional
StateMachineType

MapExecutionType. The execution type of the distributed map state This property overwrites ProcessorConfig.executionType

Default: StateMachineType.STANDARD

resultWriterOptionalDeprecated
ResultWriter

Configuration for S3 location in which to save Map Run results.

Default: - No resultWriter

Deprecated: Use {@link resultWriterV2 }

resultWriterV2Optional
ResultWriterV2

Configuration for S3 location in which to save Map Run results Enable "@aws-cdk/aws-stepfunctions:useDistributedMapResultWriterV2" feature in the context to use resultWriterV2 Example: stack.node.setContext("@aws-cdk/aws-stepfunctions:useDistributedMapResultWriterV2", true);

Default: - No resultWriterV2

toleratedFailureCountOptional
number

ToleratedFailureCount. Number of failed items to tolerate in a Map Run, as static number

Default: - No toleratedFailureCount

toleratedFailureCountPathOptional
string

ToleratedFailureCountPath. Number of failed items to tolerate in a Map Run, as JsonPath

Default: - No toleratedFailureCountPath

toleratedFailurePercentageOptional
number

ToleratedFailurePercentage. Percentage of failed items to tolerate in a Map Run, as static number

Default: - No toleratedFailurePercentage

toleratedFailurePercentagePathOptional
string

ToleratedFailurePercentagePath. Percentage of failed items to tolerate in a Map Run, as JsonPath

Default: - No toleratedFailurePercentagePath

3 properties inherited from StateBaseProps
commentOptionalinherited from StateBaseProps
string

A comment describing this state.

Default: No comment

queryLanguageOptionalinherited from StateBaseProps
QueryLanguage

The name of the query language used by the state. If the state does not contain a `queryLanguage` field, then it will use the query language specified in the top-level `queryLanguage` field.

Default: - JSONPath

stateNameOptionalinherited from StateBaseProps
string

Optional name for this state.

Default: - The construct ID will be used as state name

4 properties inherited from MapBaseOptions
itemSelectorOptionalinherited from MapBaseOptions
{ [key: string]: any }

The JSON that you want to override your default iteration input (mutually exclusive with `parameters` and `jsonataItemSelector`).

Default: $

jsonataItemSelectorOptionalinherited from MapBaseOptions
string

Jsonata expression that evaluates to a JSON array to override your default iteration input (mutually exclusive with `parameters` and `itemSelector`). Example value: `{% {\"foo\": \"foo\", \"input\": $states.input} %}`

Default: $

jsonataMaxConcurrencyOptionalinherited from MapBaseOptions
string

JSONata expression for MaxConcurrency. A JSONata expression that evaluates to an integer, specifying the maximum concurrency dynamically. Mutually exclusive with `maxConcurrency` and `maxConcurrencyPath`. Example value: `{% $states.input.maxConcurrency %}`

Default: - full concurrency

maxConcurrencyOptionalinherited from MapBaseOptions
number

MaxConcurrency. An upper bound on the number of iterations you want running at once.

Default: - full concurrency

1 property inherited from AssignableStateOptions
assignOptionalinherited from AssignableStateOptions
{ [key: string]: any }

Workflow variables to store in this step. Using workflow variables, you can store data in a step and retrieve that data in future steps.

Default: - Not assign variables

4 properties inherited from MapBaseJsonPathOptions
itemsPathOptionalinherited from MapBaseJsonPathOptions
string

JSONPath expression to select the array to iterate over.

Default: $

maxConcurrencyPathOptionalinherited from MapBaseJsonPathOptions
string

MaxConcurrencyPath. A JsonPath that specifies the maximum concurrency dynamically from the state input.

Default: - full concurrency

resultPathOptionalinherited from MapBaseJsonPathOptions
string

JSONPath expression to indicate where to inject the state's output. May also be the special value JsonPath.DISCARD, which will cause the state's input to become its output.

Default: $

resultSelectorOptionalinherited from MapBaseJsonPathOptions
{ [key: string]: any }

The JSON that will replace the state's raw result and become the effective result before ResultPath is applied. You can use ResultSelector to create a payload with values that are static or selected from the state's raw result.

Default: - None

2 properties inherited from JsonPathCommonOptions
inputPathOptionalinherited from JsonPathCommonOptions
string

JSONPath expression to select part of the state to be the input to this state. May also be the special value JsonPath.DISCARD, which will cause the effective input to be the empty object {}.

Default: $

outputPathOptionalinherited from JsonPathCommonOptions
string

JSONPath expression to select part of the state to be the output to this state. May also be the special value JsonPath.DISCARD, which will cause the effective output to be the empty object {}.

Default: $

1 property inherited from MapBaseJsonataOptions
itemsOptionalinherited from MapBaseJsonataOptions
ProvideItems

The array that the Map state will iterate over.

Default: - The state input as is.

1 property inherited from JsonataCommonOptions
outputsOptionalinherited from JsonataCommonOptions
any

Used to specify and transform output from the state. When specified, the value overrides the state output default. The output field accepts any JSON value (object, array, string, number, boolean, null). Any string value, including those inside objects or arrays, will be evaluated as JSONata if surrounded by {% %} characters. Output also accepts a JSONata expression directly.

Default: - $states.result or $states.errorOutput

Get the AWS Step Functions Cheat Sheet

Everything you need to know about AWS Step Functions on one page. HD quality, print-friendly.

Download Free Infographic