简体   繁体   English

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

[英]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 http://boto.readthedocs.org/en/latest/ref/awslamba.html?highlight=invoke

Apparently it is possible with .NET: 显然有可能使用.NET:

How can I invoke an AWS Lambda function from my EC2 instance? 如何从EC2实例调用AWS Lambda函数?

The documentation says to specify InvocationType as RequestResponse for synchronous invocation 文档说明将InvocationType指定为RequestResponse以进行同步调用

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

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 http://boto3.readthedocs.org/en/latest/reference/services/lambda.html#Lambda.Client.invoke

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM