Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

trigger lambda function on s3 upload code

exports.handler = function(event, context, callback) {
   console.log("Incoming Event: ", event);
   const bucket = event.Records[0].s3.bucket.name;
   const filename = decodeURIComponent(event.Records[0].s3.object.key.replace(/+/g, ' '));
   const message = `File is uploaded in - ${bucket} -> ${filename}`;
   console.log(message);
   callback(null, message);
};
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #trigger #lambda #function #upload #code
ADD COMMENT
Topic
Name
9+3 =