是否可以从Python Boto同步调用AWS Lambda函数?

问题描述:

此页面仅显示异步调用的方法。我想象会有一个同步调用选项。是否可以从Python Boto同步调用AWS Lambda函数?

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

显然,这是可能的.NET:

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

+2

您可以用boto3,http://boto3.readthedocs.org/en/latest/reference/指定InvocationTypeRequestResponse服务/ lambda.html#Lambda.Client.invoke – garnaat

你当然可以做到这一点。

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

documentation说,为同步调用

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