1

From an AWS Lambda function (API), I have to make a call to a service that accepts requests only through a request queue and reply to call back url.

The AWS Lambda function accepts both sync and async request.

In case of sync request, I want to make a callback to the exact same instance of Lambda which made the call.

Is it possible to get the url for callback to exact instance of an AWS Lambda function?

If it not possible , what is best way to handle the sync request from lambda when considering I don't have a control over the async service.

1
  • The simple answer to this is No you cannot callback the same instance. Commented Jan 22, 2020 at 5:29

1 Answer 1

1

No, it's not possible for a good reason.
Lambda is stateless, but you want to store a state in it.

I have to make a call to a service that accepts requests only through a request queue and reply to call back url

This callback can be handled by API Gateway with another Lambda function.

what is best way to handle the sync request from lambda when considering I don't have a control over the async service.

The best way depends on your business needs that we don't know.
In general:

  1. Use polling on client side.
  2. Store a state in DB or cache.
Sign up to request clarification or add additional context in comments.

Comments

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.