Is it possible to test AWS Lambda functions writte

2019-06-01 07:24发布

问题:

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.

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?

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.

Thanks in advance.

回答1:

Here is how we test our Lambda,

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.

Run your C# code with the version mentioned, .NET Core – .NET Core 1.0.1 (C#)

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

Hope it helps.