是否可以在本地测试用C#编写的AWS Lambda函数?

是否可以在本地测试用C#编写的AWS Lambda函数?

问题描述:

我已经开始了解AWS Lambda,并且已经编写了一个简单的lambda函数.我想知道是否可以在本地测试DLL. 例如,对于NodeJS,我们可以使用NPM软件包"lamda-local",我对此并不十分熟悉. 我已经看到,仅 SAM Local 允许NodeJS,Java和Python运行时.

I've started to learn about AWS Lambda and I've written a simple lambda function. I'd like to know if is it possible to test the DLL locally. For example, for NodeJS, we can use the NPM package called "lamda-local", which I'm not very familiar with it. I've seen that SAM Local only allows NodeJS, Java and Python runtime.

我想知道是否有一种方法可以用C#编写的Lambda函数执行相同的操作.也许我误解了在本地测试lambda函数"的概念.我认为这意味着要在我们本地计算机上的仿真环境中测试AWS Lambda函数,而无需接触"真正的AWS控制台.正确吗?

I'd like to know if there's a way to do the same with a Lambda function written in C#. Maybe I'm missunderstanding the concept of "testing the lambda function locally". I think that that means to test the AWS Lambda function in an emulated environment on our local machine, without "touching" the real AWS Console. Is that correct?

我可以尝试创建一个简单的控制台应用程序以在其中导入DLL,但是我不确定这是否是正确的方法.

I could try creating a simple Console application to import the DLLs there, but I'm not sure if that's the correct way to do it.

请向我提供其他可能有用的信息.

Please, provide me with any other information that could be useful.

谢谢.

这是我们测试Lambda的方式,

Here is how we test our Lambda,

按此处所述从AMI创建计算机,

Create a machine from AMI as mentioned here,

https://docs.aws.amazon .com/lambda/latest/dg/current-supported-versions.html

在该计算机上运行代码.如果您有与代码关联的任何本机库,则非常需要此操作.

Run your code on that machine. This is very much needed if you have any native libraries associated with your code.

使用提到的版本.NET Core – .NET Core 1.0.1 (C#)

一旦一切看起来都很好,代码也可以在生产lambda中工作.

Once everything looks good, the code works in production lambda as well.

希望有帮助.