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
59 views

1 answer to this question.

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
423 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
206 views
0 votes
1 answer
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
55 views