Niuya
Niuya

Reputation: 424

How to trigger an AWS s3 event without changing the last modified time?

I have an AWS lambda function to process data from s3, the trigger is SNS(s3 speicfied bucket "All object create events") or S3 All object create events.

For some reason, I don't want to re-upload my files to s3, and don't want to change the last modified time of s3 object) but I would like to re-use Lambda function to process the data again for the previous files.

I did try to add Tag on few files, but it will not trigger the lambda again. I tried to add a user-defined metadata, it did re-invoke lambda, but I found the last modified time was changed/updated.--this is not what I want.

Is there any method to trigger file update event from s3 for Lambda and without changing the last modified time?

In other words, I want to use lambda to re-process the large number of old files.

Thank you!

Upvotes: 1

Views: 1839

Answers (1)

Marcin
Marcin

Reputation: 238189

I don't think there is any AWS-provided out-of-the-box solution for this. Thus, you should create a custom solution for that.

S3 Events have known format. Therefore, you could develop a script or other lambda function which would generate the S3 events for your object and use AWS CLI or SDK to invoke your function with the events.

The events would need to be "manually" generated for all your files in the bucket, so you would need to list the bucket first, and then, in an iterative manner, construct the S3 events and invoke your function.

Upvotes: 2

Related Questions