Reputation: 2508
How can I configure Amazon API Gateway and AWS Step Functions like this?
Client call an api on api gateway ==> Api Gateway ===> Step Function ===> internally call an lambda => lambda returns response ==> response is send back to api gateway.
Right now, my Amazon API Gateway instead of invoking AWS Step Functions directly, it invokes a lambda which invokes step function and check its success state, then it returns response to Amazon API Gateway.
Upvotes: 1
Views: 2149
Reputation: 500
The StartExecution API is asynchronous. When you call this API you must call DescribeExecution API to get the result.
Thus, StartSyncExecution API, used with Express Type State Machines, allows you to call Step Functions synchronously. This is limited to up to 5 minutes duration.
Upvotes: 1
Reputation: 1195
With Step Functions Express Workflows, you can directly start a synchronous execution from API Gateway and return the result when it finishes. If your workflow can finish within the API Gateway timeout, this is probably the best option.
https://aws.amazon.com/blogs/compute/new-synchronous-express-workflows-for-aws-step-functions/
If using asynchronous executions, the direct API Gateway -> Step Functions integration will not return the final output of the workflow or return the response of a Lambda function.
Upvotes: 3