I am trying to invoke a method, different than the default handler method, of one lambda from another lambda. But not getting how to do it. It is not clear from the documentation. Here is my code
Lambda function 1: my_function1
import json
import boto3
def lambda_handler(event, context):
lambda_inv = boto3.client("lambda", region_name="us-east-1")
payload = {"message":"Hi From my_function1"}
lambda_inv.invoke(FunctionName='arn:aws:lambda:us-east-1:1236547899871:function:my_function2',
InvocationType='Event', Payload=json.dumps(payload))
Lambda function 2: my_function2
import json
def lambda_handler(event, context):
# TODO implement
print("lambda_handler")
def say_hello(event, context):
print("From say_hello function")
print(str(event))
print("say_hello end")
I want to invoke say_hello method of lambda my_function2 from lambda my_function1. How do I do that? By default it tries to invoke the default lambda_handler method