Created
June 27, 2016 20:35
-
-
Save BinaryBeard/d9e5b25cb395a6de9f2d9ba97cfea607 to your computer and use it in GitHub Desktop.
A simple way to invoke another 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
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