SHIFT

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

User Tools

Site Tools


Sidebar

Sponsor:


Recently Changed Pages:

View All Pages


View All Tags







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

PageDateDiscussionTags
2019/11/18 13:52 1 Comment

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
      });
}

Discussion

Enter your comment. Wiki syntax is allowed:
E Y Z T B
 
awslambdanewlambda.txt · Last modified: 2021/01/22 09:51 by sjoerd