SHIFT

--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


Sidebar

Recently Changed Pages:

View All Pages


View All Tags


LinkedIn




WIKI Disclaimer: As with most other things on the Internet, the content on this wiki is not supported. It was contributed by me and is published “as is”. It has worked for me, and might work for you.
Also note that any view or statement expressed anywhere on this site are strictly mine and not the opinions or views of my employer.


Pages with comments

View All Comments

awslambdanewlambda

AWS Lambda - Invoke new Lambda

It would be better to do this using Step Functions but sometimes quick and dirty is good enough. See the code below to invoke a new Lambda function onze your current one is done.

// Lambda Variables
var aws = require('aws-sdk');
var lambda = new aws.Lambda({
  region: 'eu-west-1' //change to your region
});
 
// Invoke nextlambda if you don't want to use Step Functions
 
// function invoke Email 
function invokeLambdaEmail(requestBody, callback, error){
    var params = {
        FunctionName: 'sendoutEmail',
        InvocationType: 'Event',
        Payload: JSON.stringify(requestBody, null, 2)
      };
      lambda.invoke(params, function(err, data) {
        if (err) console.log(err, err.stack); // an error occurred
        else     console.log(data);           // successful response
      });
}
You could leave a comment if you were logged in.
awslambdanewlambda.txt · Last modified: 2021/09/24 00:24 (external edit)