如何从EC2实例调用AWS Lambda函数?

时间:2022-12-04 07:48:14

I wrote a lambda function to take over some of the multithreaded code in our web app. Now, I'm looking to manually invoke the lambda function from an ASP.NET controller and then pass the function's return value back to the end-user.

我编写了一个lambda函数来接管我们的Web应用程序中的一些多线程代码。现在,我希望从ASP.NET控制器手动调用lambda函数,然后将函数的返回值传递给最终用户。

I thought about using AWS SQS to invoke the function but I haven't the slightest idea how to grab the return function's return value (the value passed back with context.succeed(returnData);). Any ideas?

我想过使用AWS SQS来调用函数,但我没有想法如何获取返回函数的返回值(使用context.succeed(returnData)传回的值;)。有任何想法吗?

1 个解决方案

#1


AWS Lambda now supports synchronous ("RequestResponse") invocations. For .NET, the relevant documentation is here. This will return a InvokeResponse whose Payload property is what is returned by the function -- that is, passed to context.succeed().

AWS Lambda现在支持同步(“RequestResponse”)调用。对于.NET,相关文档在这里。这将返回一个InvokeResponse,其Payload属性是函数返回的属性 - 也就是传递给context.succeed()。

#1


AWS Lambda now supports synchronous ("RequestResponse") invocations. For .NET, the relevant documentation is here. This will return a InvokeResponse whose Payload property is what is returned by the function -- that is, passed to context.succeed().

AWS Lambda现在支持同步(“RequestResponse”)调用。对于.NET,相关文档在这里。这将返回一个InvokeResponse,其Payload属性是函数返回的属性 - 也就是传递给context.succeed()。