Created
March 19, 2017 05:21
-
-
Save morishin/aa128e05985bc1ad01dd1b37051e555b to your computer and use it in GitHub Desktop.
Call Lambda function from Lambda function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.handler = function(event, context, callback) { | |
var aws = require('aws-sdk'); | |
var lambda = new aws.Lambda(); | |
lambda.invoke({ | |
FunctionName: 'your-lambda-function-name', | |
Payload: JSON.stringify(event) | |
}, function(error, data) { | |
if (error) { | |
context.done('error', error); | |
} | |
if(data.Payload){ | |
context.succeed('done') | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment