amazon-web-servicesaws-lambdaaws-step-functions

Is it Possible to Call One Step Function from another Step function?


I am new to this Step Functions and AWS. Is it Possible to call one Step Function from another Step Function in AWS (EMR)? I am developing one Step function and i have to include Step Function in EMR before Stopping EMR.

Here I am having Two scenarios.

1) I have to call SFN3 from SFN2 and Stop the EMR in SFN2. 2) I have to Stop EMR after Execution of All Step funcitons.

I have included Attachment for your reference.

enter image description here

Kindly help me.

Many thanks.


Solution

  • You can call StartExecution from Task State (Lambda or Activity) and then wait for it to complete (or not, if you do not require it).

    If you do not need to wait for it to complete (I may have misunderstood the question, but I believe this is not the case), you may just fire&forget with StartExecution.

    In the opposite case, when you want to wait for nested State Machine to finish, you may be interested in Job Status Poller pattern (https://docs.aws.amazon.com/step-functions/latest/dg/job-status-poller-sample.html) or implement waiting as an Activity running on a EC2 / ECS / etc. (losing serverless approach).

    There is also another approach to the problem of waiting for nested State Machine without active loop (status poller) or servers. It is described here: https://medium.com/semantive/part-1-asynchronous-actions-within-aws-step-functions-without-servers-f58e030a0e8b