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

Invoke a AWS Step functions by API Gateway and wait for the execution results


Is it possible to invoke a AWS Step function by API Gateway endpoint and listen for the response (Until the workflow completes and return the results from end step)?

Currently I was able to find from the documentation that step functions are asynchronous by nature and has a final callback at the end. I have the need for the API invocation response getting the end results from step function flow without polling.


Solution

  • I guess that's not possible.

    It's async and also there's the API Gateway Timeout

    You don't need get the results by polling, you can combine Lambda, Step Functions, SNS and Websockets to get your results real time.

    If you want to push a notification to a client (web browser) and you don't want to manage your own infra structure (scaling socket servers and etc) you could use AWS IOT. This tutorial may help you to get started:

    http://gettechtalent.com/blog/tutorial-real-time-frontend-updates-with-react-serverless-and-websockets-on-aws-iot.html

    If you only need to send the result to a backend (a web service endpoint for example), SNS should be fine.