gdahugo
gdahugo

Reputation: 103

AWS The lambda function is not triggered by S3 after an upload

I have a problem with AWS Lambda and S3.

I deploy all my AWS architecture with terraform. I have a bucket in which I can upload XML files which triggers a lambda to process these files (the events are well informed).

The problem is that after the deployment of my architecture, when I drop an XML file in my bucket, nothing happens the first few times. As if the first files I upload are not taken into account and S3 doesn't send a notification to Lambda.

Sometimes I have to send several files to S3 before it starts to be taken into account or I modify with the GUI the notifications in the S3 console, without changing anything and just by clicking on "Save". I don't know how to investigate this problem.

Could you tell me if anyone has ever had a similar case? Also, would you know if it is possible to see a history of everything that happens on an S3 bucket (uploaded files, sent events, ...) to investigate my problem?

Thanks in advance.

Upvotes: 2

Views: 10184

Answers (1)

WaltDe
WaltDe

Reputation: 1842

The key to what you are experiencing is that it occurs right after you create the bucket and the trigger. A lot of AWS systems have an eventual consistency model. In the case of S3 both objects and the buckets have eventual consistency across 3 Availability Zones.

In short, you are putting an object to one of the S3 instances before the event trigger on that instance of S3.

Upvotes: 1

Related Questions