Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to synchronously invoke an AWS Lambda function from Python Boto?

This page shows only a method for asynchronous invocation. I imagined there would be a synchronous invocation option.

http://boto.readthedocs.org/en/latest/ref/awslamba.html?highlight=invoke

Apparently it is possible with .NET:

How can I invoke an AWS Lambda function from my EC2 instance?

like image 333
Duke Dougal Avatar asked Sep 26 '22 21:09

Duke Dougal


2 Answers

The documentation says to specify InvocationType as RequestResponse for synchronous invocation

response = client.invoke(
    FunctionName='string',
    InvocationType= 'RequestResponse',
    LogType='None'|'Tail',
    ClientContext='string',
    Payload=b'bytes'|file,
    Qualifier='string'
)
like image 93
RAbraham Avatar answered Oct 11 '22 13:10

RAbraham


You can certainly do this.

response = client.invoke(
    FunctionName='string',
    InvocationType='Event'|'RequestResponse'|'DryRun',
    LogType='None'|'Tail',
    ClientContext='string',
    Payload=b'bytes',
    Qualifier='string'
)

http://boto3.readthedocs.org/en/latest/reference/services/lambda.html#Lambda.Client.invoke

like image 38
Michael Avatar answered Oct 11 '22 14:10

Michael