SNS to Lambda vs SNS to SQS to Lambda

后端 未结 5 2069
慢半拍i
慢半拍i 2021-02-01 13:45

I\'m trying to understand whether I need SQS in my workflow if someone can help explain. In my app, when an action is taken, it submits info to SNS topic which invokes LAMBDA to

5条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-01 14:15

    The only advantage of having a SQS in between SNS and Lambda is Reprocessing. Assume that the Lambda fails to process certain event for some reason (e.g. timeout or lack of memory footprint), you can increase the timeout (to max 5 minutes) or memory (to max of 1.5GB) and restart your polling and you can reprocess the older events.

    This would not be possible in case of SNS to Lambda, wherein if Lambda fails the event is lost. And even if you configure DLQ you would still have to make provisions for reading that separately and processing the message

    So if your events are critical and you don't want to miss out on them, then go for SNS - SQS - Lambda

    Having said that SQS cannot trigger lambda like SNS. You will have to poll the SQS at frequent intervals

    EDIT :

    AWS announced SQS triggering Lambda support on 28 JUN 2018. So no need anymore for polling the queue at frequent intervals. New items to SQS can trigger Lambda

提交回复
热议问题