We have a trigger set on a lambda function and would like to grab the newest file from an S3 bucket when it is dropped into it. The filename will change. We want to grab the file object from the event but cannot figure out how.
Right now, we have the direct filename written as a variable in the lambda function and are testing it locally. It seems to work but we want to make our lambda generic and grab the file using the event param passed in. Basically, we need to swap out these two lines and make them generic.
const bucket = 'bucket-12345';
const key = 'testXML.xml';
Thank you for any assistance.