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

Invoking a step function synchronously from a lambda function


I have a lambda function which is triggered by a FIFO SQS. I only want one instance of the function running. The function invokes a state machine and the state machine takes longer to finish than the lambda function. I want the lambda function to finish only after the step function has completed it's execution.


Solution

  • AWS Step Functions are only invoked asynchronously. A state machine can run for up to 1 year so synchronous invocation is not possible. Depending on your workflow you might find Activities useful.

    Activities are an AWS Step Functions feature that enables you to have a task in your state machine where the work is performed by a worker that can be hosted on Amazon Elastic Compute Cloud (Amazon EC2), Amazon Elastic Container Service (Amazon ECS), mobile devices—basically anywhere.