Sunday, 9 April 2017

How to trigger my Lambda Function once the file is uploaded to s3 bucket

I have upload a zip file to S3 bucket.I need to trigger my below lambda
function immediately once the zip file has been uploaded.Kindly help me how to proceed

exports.handler = function (event, context) { 

MyLambdaFuntion();
}

MyLambdaFuntion()
{
var bucketName = "TestBucket1";
var fileKey = "test.js";
s3.getObject(params, function (err, data) {
if (err)
    console.log(err, err.stack);
   else {
          console.log(data);
       }
 });
}



via Sharan

No comments:

Post a Comment