0

I have 2 AWS Lambda functions defined using AWS CDK. The stack has them defined pretty straight forward.

How do I call Lambda function 2 from Lambda function 1? Is using state machines (AWS Step Functions) really the only way? I don't mind them but would really like to know how to call a Lambda function in code.

Noel Llevares
  • 15,018
  • 3
  • 57
  • 81
IdiotDrake
  • 37
  • 9
  • 2
    Does this answer your question? [Can an AWS Lambda function call another](https://stackoverflow.com/questions/31714788/can-an-aws-lambda-function-call-another) – Robert Harvey Feb 15 '22 at 22:36
  • You can simply call the `invoke()` API. – John Rotenstein Feb 15 '22 at 22:52
  • There are so many ways to call a Lambda from another Lambda. You have describe more details as to why you want to do this so we can point you to the right direction. Also, this is not CDK-related. – Noel Llevares Feb 15 '22 at 23:41

1 Answers1

0

The best approach would be triggering Lambda 2 event driven. You can create an SNS topic and register it as destination for Lambda 1 and as trigger for Lambda 2.