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, 2019 in AWS by Ramya Mantri
2,302 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, 2019 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
3 answers

Is it possible to ping AWS EC2 instance

1.Go to EC2 Dashboard and click "Running ...READ MORE

answered Nov 13, 2020 in AWS by shivam
• 140 points

edited Nov 13, 2020 by Gitika 20,358 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to rename files on AWS?

I have tried this and it works ...READ MORE

answered Mar 12, 2019 in AWS by Reena
1,776 views
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, 2019 in AWS by Reena
643 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP