Reputation: 11
I have two Lambda's that responds to SNS Notifications on a non-fifo topic from a ObjectCreated:* event on an S3 object. Within a margin of 2 seconds, the S3 object is updated twice. My subscribed lambda's seem to only respond to the first update. Is this known behaviour? Only one event seems to have been emitted.
If the updates where published as two records in one SNS Event, my application would be prepared to handle both events. Unfortunately, a second record does not seem to be available in the payload.
Upvotes: 0
Views: 262
Reputation: 11
Amazon has an archived developer’s guide which states:
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. If two writes are made to a single non-versioned object at the same time, it is possible that only a single event notification will be sent. If you want to ensure that an event notification is sent for every successful write, you can enable versioning on your bucket. With versioning, every successful write will create a new version of your object and will also send an event notification.
However, in [the new open source user’s guide] (April, 2021), this note has been removed.
I think turning on versioning will probably fix this error, but this also comes with the extra costs.
I’m awaiting the answer on a support ticket, I promise to update this answer with my latest findings. In the meanwhile, this should offer a workaround along with some guidance on the reasoning.
Upvotes: 1
Reputation: 1228
A lot of AWS systems have an eventual consistency model. In the case of S3 updating objects have eventual consistency across 3 Availability Zones.
In short, you are updating an object to one of the S3 instances before the event trigger on that instance of S3.
Can it be that you have both events in the same payload?
Upvotes: 0