I have a step function which has 2 states, lets suppose state1 and state2, state1 triggers a lambda and returns a wait state to state1, step function waits.
Lambda triggers aws batch, on completion of aws batch, it should resume the step function.
And step function should go to the next state i.e. state2.
So How to resume step function on aws batch job completion.
It’s a serverless architecture.
I have tried cloudwatch event.
Is there any alternate way?
Note: AWS Batch takes more than 20 minutes for execution.
2
Answers
Note: This will only work if your batches in aws lambda take less than 15 minutes.
Enable wait for callback option in first lambda invoke of step function.
you can add payload something like below to use pass token, as per your input data.
Finally in lambda return task token on completion of aws batch by using send task token success.
I suspect you want to use the AWS Step Functions Optimized Service Integration for AWS Batch. This integration supports the .sync / Run a Job Integration Pattern where Step Functions will manage monitoring your Batch Job and continuing the workflow execution when it completes.
You can do drag and drop this into your workflow definition using Workflow Studio, as shown in this screen shot.
The Amazon States Language for this will follow this form: