Search code examples
amazon-web-servicesstate-machineaws-step-functions

Common pass state for multiple branches


In my step function there are parallel states under which there is a choice state. If the choice is true , the corresponding lambda is invoked. If not, we exit from the branch without executing the lambda. Exit Pass state is as below for all the parallel branches as Choice states don't support the End field

 Pass:
  Type: Pass
  End: true 


Pass(1):
  Type: Pass
  End: true 

Pass(2):
  Type: Pass
  End: true 

Is it possible to instead send them all to a single pass state to avoid having to create a bunch of extra states for each branch?

enter image description here


Solution

  • You can only refer to the states declared within the given branch of parallel state. Given that your choice states are in 2 different branches, they cannot "share" a state to point their default choice to. One solution here (if you don't want to repeat pass state) would be to handle the choice inside of lambda function, based on its input.