Search code examples
aws-step-functions

AWS Step Function: custom end state for choices


I have a choice state like below:

"ChoiceStateX": {
  "Type": "Choice",
  "Choices": [
    {
      "Not": {
        "Variable": "$.type",
        "StringEquals": "Private"
      },
      "Next": "Public"
    },
    {
      "Variable": "$.value",
      "NumericEquals": 0,
      "Next": "MyEndState"  // can I do something like this? 
    },
}

For the state with $.value == 0, I need to end the step function, because Choices does NOT support End: true, I need explicitly to have something like MyEndState.

So how should I define MyEndState inside the step function? Is there a such way?


Solution

  • What I do in that case is add a PassState that has End: true, and send the Next of the ChoiceState to that state.