Search code examples
amazon-web-servicesaws-step-functions

AWS State Machine that can "branch" into a different State Machine by ARN


I want to have an AWS State machine that can branch the execution graph into a separate state machine like,

State Machine drawing

Where the execution is branching into the other state machine. I should note that ideally, I could go cross account. From here and here, we get information about creating the compute graph for state machines, but it's not obvious if I can/cannot make a task specify a separate state machine for the execution resource.

What I want can be done with Lambda functions making start_execution calls, but that's no super elegant.

Is there a good way to do this?


Solution

  • That's good question, but in my experience with Step Functions - you can't "branch" into a different state machine.

    As you mentioned - it's possible to start execution of another state machine, but moreover than "not elegant" it's almost impossible to "halt" state machine and continue execution when another execution ends.

    "Almost" - because actually you can achieve that by making "task" state that is looped and lambda inside periodically polls that another execution...

    I would suggest you to just copy+paste that different state machine inside your initial state machine.