I have a map state that takes an array as input. I understand that the map will iterate over the elements of the array. However, what I want to do is pass the output of one iteration into the input of the next. Is this possible without writing to a DB or S3? I have tried endless combinations of InputPath, OutputPath, and ResultPath, but no matter what I do to try to modify the input of state 1 from state 0, it simply reads from the array, and it seems I can't modify the input array from within the map. Example template:
"Map":{
"Type": "Map",
"ItemsPath": "$.stages",
"Parameters": {
"stage.$": "$$.Map.Item",
},
"Iterator": {
"StartAt": "StartStage",
"States": {
"StartStage":{
"Type": "Task",
"Resource":"arn:aws:states:::lambda:invoke.waitForTaskToken",
"Parameters":{
"FunctionName":"...",
"Payload":{
"myArgs.$": "$.stage.Value",
}
},
"End": true
}
}
},
"MaxConcurrency": 1,
}
The other option is to create a while loop like this:
This way you have access to the result of previous iteration. But processing and merging the result of iteration is not happening automatically and you need to add a state to do it for you.