Question:
Is it possible to have following kind of Step Function graph, i.e. from 2 parallel state output, one combined state:
If yes, what would json for this looks like? If not, why?
Answer:
A parallel task always outputs an array (containing one entry per branch).
You can tell AWS step functions to append the output into new (or existing) property in the original input with "ResultPath": "$.ParallelOut"
in your parallel state definition, but this is not what you seem to be trying to achieve.
To merge the output of parallel task, you can leverage the "Type": "Pass"
state to define transformations to apply to the JSON document.
For example, in the state machine below, I’m transforming a JSON array…
1 2 3 4 5 6 7 8 9 10 11 |
[ { "One": 1, "Two": 2 }, { "Foo": "Bar", "Hello": "World" } ] |
…into a few properties
1 2 3 4 5 6 7 |
{ "Hello": "World", "One": 1, "Foo": "Bar", "Two": 2 } |

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
{ "Comment": "How to convert an array into properties", "StartAt": "warm-up", "States": { "warm-up": { "Type": "Parallel", "Next": "array-to-properties", "Branches": [ { "StartAt": "numbers", "States": { "numbers": { "Type": "Pass", "Result": { "One": 1, "Two" : 2 }, "End": true } } }, { "StartAt": "words", "States": { "words": { "Type": "Pass", "Result": { "Foo": "Bar", "Hello": "World" }, "End": true } } } ] }, "array-to-properties": { "Type": "Pass", "Parameters": { "One.$": "$[0].One", "Two.$": "$[0].Two", "Foo.$": "$[1].Foo", "Hello.$": "$[1].Hello" }, "End": true } } } |