I'm trying to understand the behavior of S3 Event Notification trigger. I have s3 events to trigger lambda. Lambda captures the event and file metadata to dynamodb. There would be around 50k event triggers in short burst across the day. If I had to add SNS in the workflow and have SNS trigger lambda, what are the advantages with sns vs s3 directly invoking lambda?
2 Answers
8
votes
There is no gained advantage. Both S3 and SNS events are asynchronous event sources and behave the same way. See: Lambda supported event sources And: Lambda Retry on Errors (Asynchronous invocation part), which highlights nicely the lambda behavior with specific types of event sources.
Simply doing S3 -> Lambda is sufficient.
8
votes
The advantage is flexibility for the future. If you use SNS in the middle, you can easily send (fan-out) the notifications to multiple destinations with more SNS topic subscriptions -- another Lambda function, an SQS Queue, an HTTPS endpoint, or even email, which can be very useful for non-intrusive observation, testing, troubleshooting, and developing new capabilities that need the same notification.