I have created a step function as you can see in the picture. Now I need to execute StepX after StepK (And then the ChoiceA flow will end). So basically StepX should be executed in parallel with StepY->StepZ as it is now but also be executed after StepK. But I cannot find a way to access a stage which is inside a parallel block". Is there a way around this?
Here is my Json-
{
"StartAt": "DataPointsExtractor",
"States": {
"DataPointsExtractor": {
"Type": "Task",
"Resource": "arn:aws:lambda:*******",
"Next": "PathDecider"
},
"PathDecider": {
"Type": "Choice",
"Choices": [
{
"Variable": "$.path_type",
"StringEquals": "ChoiceA",
"Next": "ChoiceA"
},
{
"Variable": "$.path_type",
"StringEquals": "ChoiceB",
"Next": "ChoiceB"
}
],
"Default": "NoMatchesState"
},
"ChoiceA": {
"Type": "Task",
"Resource": "arn:aws:lambda:*******",
"Next": "StepK"
},
"StepK": {
"Type": "Task",
"Resource": "arn:aws:lambda:*******",
"End": true
},
"ChoiceB": {
"Type": "Task",
"Resource": "arn:aws:lambda:*******",
"Next": "ParallelStates"
},
"ParallelStates": {
"Type": "Parallel",
"Branches": [
{
"StartAt": "StepX",
"States": {
"StepX": {
"Type": "Task",
"Resource": "arn:aws:lambda:*******",
"End": true
}
}
},
{
"StartAt": "StepY",
"States": {
"StepY": {
"Type": "Task",
"Resource": "arn:aws:lambda:*******",
"Next": "StepZ"
},
"StepZ": {
"Type": "Task",
"Resource": "arn:aws:lambda:*******",
"End": true
}
}
}
],
"End": true
},
"NoMatchesState": {
"Type": "Fail",
"Cause": "No Matches!"
}
}
}
You should keep it simple. As ChoiceA and ChoiceB are separate flows, they don't need to intersect. StepX can be used twice (you will have to use different name for it though)
Definition:
{
"StartAt": "DataPointsExtractor",
"States": {
"DataPointsExtractor": {
"Type": "Task",
"Resource": "arn:aws:lambda:*******",
"Next": "PathDecider"
},
"PathDecider": {
"Type": "Choice",
"Choices": [
{
"Variable": "$.path_type",
"StringEquals": "ChoiceA",
"Next": "ChoiceA"
},
{
"Variable": "$.path_type",
"StringEquals": "ChoiceB",
"Next": "ChoiceB"
}
],
"Default": "NoMatchesState"
},
"ChoiceA": {
"Type": "Task",
"Resource": "arn:aws:lambda:*******",
"Next": "StepK"
},
"StepK": {
"Type": "Task",
"Resource": "arn:aws:lambda:*******",
"Next": "StepX"
},
"StepX": {
"Type": "Task",
"Resource": "arn:aws:lambda:*******",
"End": true
},
"ChoiceB": {
"Type": "Task",
"Resource": "arn:aws:lambda:*******",
"Next": "ParallelStates"
},
"ParallelStates": {
"Type": "Parallel",
"Branches": [
{
"StartAt": "StepX",
"States": {
"StepX": {
"Type": "Task",
"Resource": "arn:aws:lambda:*******",
"End": true
}
}
},
{
"StartAt": "StepY",
"States": {
"StepY": {
"Type": "Task",
"Resource": "arn:aws:lambda:*******",
"Next": "StepZ"
},
"StepZ": {
"Type": "Task",
"Resource": "arn:aws:lambda:*******",
"End": true
}
}
}
],
"End": true
},
"NoMatchesState": {
"Type": "Fail",
"Cause": "No Matches!"
}
}
}