Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kmkale/2a4d0cdbbff6ca0231ef7408f7e17d1f to your computer and use it in GitHub Desktop.
Save kmkale/2a4d0cdbbff6ca0231ef7408f7e17d1f to your computer and use it in GitHub Desktop.
invokeLambda Function for aws-process-default-sg-security-rules
/**
* Invokes the given lambda function with received invoke_params
* @param {Object} invoke_params object with region and VPC arrays
* @param {String} functionName Name of the Lambda function to invoke
*/
function invokeLambda(invoke_params, functionName, callback) {
console.log("invokeLambda received invoke_params: " + JSON.stringify(invoke_params));
console.log("invokeLambda received functionName: " + functionName);
var params = {
FunctionName: functionName,
InvocationType: "Event",
Payload: JSON.stringify(invoke_params)
};
lambda.invoke(params, function(err, data) {
if (err) {
console.log("Error in invokeLambda " + JSON.stringify(err));
callback(err);
} else {
console.log("in invokeLambda got data: " + data);
callback(null, data);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment