Getting lambda response when calling lambda through SQS

I have the following pipeline:

Script --> SQS --> Lambda

  • A script sends a message to a SQS queue.
  • Based on the content of this message, the Lambda executes a different process (Calls an API with some payload)
  • The script needs to receive the API HTTP response, output of Lambda.

How can I achieve this last step? (Ideally using boto3)

1 answer

  • answered 2022-01-18 12:42 luk2302

    You can't / don't. If you want a response from the lambda invoke the lambda directly and synchronously. Putting a queue between you and the lambda explicitly decouples your script from the lambda.

    You could include some path / identifier in the message which tells the lambda where to put the response, e.g. under what dynamodb entry or into which S3 key. And then your script would need to poll that target location for an update from the lambda. But that to me sounds overly complicated and I am not sure what you gain over just calling the lambda directly.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum