> [!META]- Inline Metadata [status:: boat] [tags:: #state/boat #note/evergreen #concepts/aws/step-functions ] [up:: [[AWS MOC]]] You can use a Map State for this. You define it like so in CDK: ```python from aws_cdk import aws_stepfunctions as sfn, aws_stepfunctions_tasks as sfn_tasks map_lambda_task = sfn_tasks.LambdaInvoke( self, "task-name", lambda_function=function_lambda, payload=sfn.TaskInput.from_object( { "item_key": sfn.JsonPath.string_at("$.item_key") } ), output_path="$.Payload" ) map_state = sfn.Map( self, "state-name", items_path="$.item_key", input_path="$, parameters={ "item_key.quot;: "$.Map.Item.Value" } ) map_state.item_processor(processor=map_lambda_task) ``` This sets up a lambda task (using an existing Lambda function, not shown) to be invoked as a Step Function task, and the map state that calls it in the iterator. The iterator iterates through each item in the Map's input, then calls the task for each item in the list passed to the state as input, using a single item (whether it's a primitive or another container like a list or dict).