In AWS Lambda, how to invoke one Lambda function from another ?
Here is a sample JavaScript lambda function invoking another Lambda function (setMFA),
const aws = require('aws-sdk')
exports.handler = async function(event, context) {
const lambda = new aws.Lambda({
region: 'us-west-2'
});
let mfaResponse = await lambda.invoke({
FunctionName: 'setMFA',
Payload: JSON.stringify(
userPoolId : "userPoolId",
username : "Username",
mfa : true
)
}
}
For this to work the invoking lambda function will require permissions to lambda:InvokeFunction
.