Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are AWS S3 Event Notifications guaranteed to be delivered?

I'm hooking up AWS S3 event notifications to an AWS Lambda processing pipeline.

I can't find documentation on S3 event notification guarantees. Can I be sure all S3 events will fire the lambda processes? Order does not concern me, just that my lambda eventually does get fired.

If no such guarantee exists, how to architect to deal with this?

like image 299
Mike Hogan Avatar asked Dec 12 '15 09:12

Mike Hogan


3 Answers

Update 2020

The events are now at least once: https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html

Relevant quote from that page:

Amazon S3 event notifications are designed to be delivered at least once. Typically, event notifications are delivered in seconds but can sometimes take a minute or longer.

Original answer

In principle yes. However, Lambda has a 99.9% SLA and S3 has a 99.9% uptime SLA as well. So in theory some events could be missed, but only when they have a service disruption. When the Lambda function fails, it automatically retries up to three times.

I use S3 as a 'queue' for Lambda and have never missed a message (out of millions and millions).

There's not much you can do to deal with this I think. Part of using 'serverless' infrastructure means that you also lose some control (however, I think that AWS can do a better job than just myself and a few dedicated servers).

like image 192
Luc Hendriks Avatar answered Nov 11 '22 04:11

Luc Hendriks


It's quite interesting that AWS has upgraded semantic from at most once to at least once just by documentation, not the product.

Before 2020, it's something like below per this link:

Amazon S3 event notifications typically deliver events in seconds but can sometimes take a minute or longer. On very rare occasions, events might be lost. If your application requires particular semantics (for example, ensuring that no events are missed, or that operations run only once), we recommend that you account for missed and duplicate events when designing your application. You can audit for missed events by using the LIST Objects API or Amazon S3 Inventory reports. The LIST Objects API and Amazon S3 inventory reports are subject to eventual consistency and might not reflect recently added or deleted objects.

In 2020, it's changed to at least once, as below:

Amazon S3 event notifications are designed to be delivered at least once. Typically, event notifications are delivered in seconds but can sometimes take a minute or longer.

In Nov 2021, it's downgraded again to only once, per this PR.

By default, Amazon S3 event notifications are delivered only once. Most of the time, event notifications are delivered in seconds. However, sometimes it can take a minute or longer for them to be delivered.

In Dec 2021, we pointed out that AWS made a backward incompatible change, AWS explained it was an incident of the document change, though I don't believe it. So AWS soon changed the document back to as below:

Amazon S3 event notifications are designed to be delivered at least once. Typically, event notifications are delivered in seconds but can sometimes take a minute or longer

But AWS support also told us, that it's designed to be at least once, but does not guarantee anything.

So it's not only confusing, but also misleading.

like image 20
Youjun Yuan Avatar answered Nov 11 '22 02:11

Youjun Yuan


From the Documentation Important Amazon S3 event notifications typically deliver events in seconds but can sometimes take a minute or longer. On very rare occasions, events might be lost.

We are seeing lost events right now. A lot in volume but low by percentage.

like image 27
iZian Avatar answered Nov 11 '22 02:11

iZian