0

The premise is pretty simple.

The usual application flow is as follows:

  1. API Gateway receives a request.
  2. API Gateway triggers Lambda Function with parameters.
  3. Lambda Function runs the logic.
  4. The Lambda Function's response is automatically forwarded to API Gateway as the response to step 1 (Response to the Received API Request).

Here's the issue I'm having. I need to run two functions before returning the response to the received API request. I need the return statement from the second function in step 4 to be the response sent back to the client.

Now there are more examples where this is necessary. In the future, we might need to run a few services (such as lambda > Lambda > PostgreSQL > API Response) before responding to the request.

Is there a way to receive a request from a client, then run a host of tasks, assemble the necessary data, then use this data as a response in the original API request? So far step-functions seemed a likely solution but I don't know if it can do this.

1 Answer 1

1

Until recently this would've been a pain with Step Functions but around re:invent time last year they announced the ability to orchestrate synchronous express workflows: https://aws.amazon.com/blogs/compute/new-synchronous-express-workflows-for-aws-step-functions/

IMO, this would be the best / easiest way to implement what you're looking for.

Sign up to request clarification or add additional context in comments.

1 Comment

That's very enlightening, thank you. This answers my question

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.