Adrianus Hendry
Adrianus Hendry

Reputation: 143

AWS SNS > SQS > Lambda Trigger. Is this async or sync invocation?

I am using Client > SNS > SQS > Lambda Trigger

As per my understanding, SNS > Lamda will be an asynchronous invocation

However, SNS > SQS > Lambda supposed to be synchronous.

  1. Is my understanding correct?

I have configured DLQ on the SQS source but doesn’t store failed message into DLQ. Also saw 2x retried attempt on Lambda cloudwatch.

  1. If SNS > SQS > Lambda is synchronous, I think this should not happen am I right?

Upvotes: 1

Views: 3149

Answers (1)

Ersoy
Ersoy

Reputation: 9624

@jellycsc already answered your question in the comment section, but i would like to expand it. Shortly it is poll based which uses synchronous invocation for it.

There are three type of invocation models for AWS Lambda

  1. Synchronous
    • Elastic Load Balancing
    • Alexa
    • Cognito
    • API Gateway (there is an async version of it too)
  2. Asynchronous
    • S3
    • SNS
    • Cloudwatch/Eventbridge events
  3. Poll-based
    • Kinesis
    • SQS
    • DynamoDB streams

According to the this blogpost

AWS will manage the poller on your behalf and perform Synchronous invokes of your function with this type of integration. The retry behavior for this model is based on data expiration in the data source. For example, Kinesis Data streams store records for 24 hours by default (up to 168 hours).

Upvotes: 4

Related Questions