I am able to call lambda function from another lambda function but by default it goes to handler method. How do I invoke some other method defined in it?
Suppose there is lambda function master.py, which will have common methods which can be used by other lambda functions so that I don't have to write them again and again in every function. Now I want to call methods of master.py (lets say getTime(), authenticateUser() etc) from other lambda functions.
Basically I want to keep a lambda function which will have common methods which can be used by other lambda functions.
Any help is appreciated.
Below is the code I have tried to call one lambda function from another (i have taken code from this question) but it goes to handler() method:
lambda function A
def handler(event,context):
params = event['list']
return {"params" : params + ["abc"]}
lambda function B invoking A
import boto3
import json
lambda_client = boto3.client('lambda')
a=[1,2,3]
x = {"list" : a}
invoke_response = lambda_client.invoke(FunctionName="functionA",
InvocationType='RequestResponse',
Payload=json.dumps(x))
print (invoke_response['Payload'].read())
Output
{
"params": [1, 2, 3, "abc"]
}