0
votes

I need to make two lambda function, one call the other with parameter, the called function print the parameter out.I got trouble to make it works: The first function:

from __future__ import print_function
import boto3
import json

lambda_client = boto3.client('lambda')

def lambda_handler(event, context):

    invoke_response = lambda_client.invoke(FunctionName="called-function",
                                           InvocationType='Event',
                                           Payload=json.dumps('hello Jenny'))
                                           )
    print(invoke_response)              

Please advise what code should I put in the called-function in order to receive the parameter 'hello Jenny'? Thank you

1

1 Answers

0
votes

The Payload supplied in the params will be available as the event of the Lambda being invoked.

def add(event, context):
    # event is 'hello Jenny'
    return event