AWS s3 event ObjectRemoved - get file

Viewed 393

I am trying to access the file that has been deleted from an s3 Bucket using aws lambdas.

I have set up a trigger for s3:ObjectRemoved*, however after extracting the bucket and file name of the deleted file, the file is deleted from s3 so I do not have access to the contents of the file.

What approach should be taken with AWS lambda to get the contents of the file after a file is deleted from an s3 bucket.

1 Answers

Comment proposed by @keithRozario was useful however with versioning, applying a GET request will result in a not found error as per the s3 documentation.

@Ersoy suggestion of creating a 'bin' bucket or directory/prefix with the same file name and working with that as per your requirements.

In my case copying the initial object created to a bin directory and then accessing that folder when the file is deleted from the main upload directory.

Related