Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does AWS S3 Have a concept of files being 'updated'?

I'd like to write a Lambda function that is triggered when files are added or modified in an s3 bucket and processes them and moves them elsewhere, clobbering older versions of the files.

I'm wondering if AWS Lambda can be configured to trigger when files are updated?

After reviewing the Boto3 documentation for s3 it looks like the only things that could happen in a s3 bucket would be creations and deletions.

Additionally, the AWS documentation seems to indicate there is no way to trigger things on 'updates' to S3.

Am I correct in thinking there is no real concept of an 'update' to a file in S3 and that an update would actually be when something was destroyed and recreated? If I'm mistaken, how can I trigger a Lambda function when an S3 file is changed in a bucket?

like image 861
Fernando Avatar asked Dec 11 '22 14:12

Fernando


1 Answers

No, there is no concept of updating a file on S3. A file on S3 is updated the same way it is uploaded in the first place - through a PUT object request. (Relevant answer here.) An S3 bucket notification configured to trigger on a PUT object request can execute a Lambda function.

like image 87
jzonthemtn Avatar answered Jan 04 '23 15:01

jzonthemtn