Is it possible to call an AWS lambda function from another lambda function?

0 votes
Can someone help me on how to do this? I have looked for answers almost everywhere but didn't find a solution. Please help.
Mar 12 in AWS by Ramya Mantri
44 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Here is what I found on Amazon docs using AWS SDK:

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

You can find the doc here: http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Lambda.html

answered Mar 12 by Sukanya
It is better to use the (Lambda) -> (SNS) -> (Lambda) pattern as this adds a level of retry logic (sns will retry three times) should the initial request fail.  It also allows you to connect functions together without having to hack the code thus keeping a clean separation between deployment and business solution.
Yes, thats a good approach.

Related Questions In AWS

+2 votes
2 answers

Is it possible to ping AWS EC2 instance

Start by adding a new EC2 security group inbound ...READ MORE

answered Apr 9, 2018 in AWS by hemant
• 5,750 points
284 views
0 votes
1 answer

Is it possible to stop nodes in AWS ElastiCache cluster

At this time there is not a ...READ MORE

answered Jun 20, 2018 in AWS by Flying geek
• 3,150 points
119 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Download an entire S3 bucket

You can use s3cmd to download your bucket. s3cmd --configure s3cmd ...READ MORE

answered Mar 12 in AWS by Reena
13 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.