Skip to content

Instantly share code, notes, and snippets.

@BinaryBeard
Created June 27, 2016 20:35
Show Gist options
  • Save BinaryBeard/d9e5b25cb395a6de9f2d9ba97cfea607 to your computer and use it in GitHub Desktop.
Save BinaryBeard/d9e5b25cb395a6de9f2d9ba97cfea607 to your computer and use it in GitHub Desktop.
A simple way to invoke another lambda function
var aws = require('aws-sdk');
var lambda = new aws.Lambda({
region: 'us-west-2' //change to your region
});
lambda.invoke({
FunctionName: 'name_of_your_lambda_function',
Payload: JSON.stringify(event, null, 2) // pass params
}, function(error, data) {
if (error) {
context.done('error', error);
}
if(data.Payload){
context.succeed(data.Payload)
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment