Silver Silver - 3 months ago 51x
Node.js Question

Can an AWS Lambda function call another

I have 2 Lambda functions - one that produces a quote and one that turns a quote into an order.
I'd like the Order lambda function to call the Quote function to regenerate the quote, rather than just receive it from an untrusted client.

I've looked everywhere I can think of - but can't see how I'd go about chaining or calling the functions...surely this exists!


I found a way using the aws-sdk.

var aws = require('aws-sdk');
var lambda = new aws.Lambda({
  region: 'us-west-2' //change to your region

  FunctionName: 'name_of_your_lambda_function',
  Payload: JSON.stringify(event, null, 2) // pass params
}, function(error, data) {
  if (error) {
    context.done('error', error);

You can find the doc here: