简体   繁体   中英

Is it possible to test AWS Lambda functions written in C# locally?

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.

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.

One can debug a lambda function locally using The AWS .NET Mock Lambda Test Tool .

This tool comes inbuilt with AWS Toolkit for Visual Studio .

After installing the tool and configuring your AWS profile , click on F5 to start debugging the function. You can invoke the lambda by clicking on Execute Function after inserting appropriate input payload.

调试 调用

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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