AWS Lambda, one of the most popular FaaS providers, added support for .Net Core Runtime 1.0 a whole two years after it’s release in 2014 and in 2018 added the support for .Net Core 2.0 runtime. While similar in name, the .Net Core differs from the other .Net frameworks for a number of reasons. Here are the main ones: * .NET Core is the new redesigned version of .NET that focuses on more modern applications and in particular, cloud-enabled applications which has significant benefits when writing Lambda functions * .NET Core was designed with a modularized design which means you only get to include the part of .NET you will need when writing your Lambda functions. This leads to lesser memory usage and since Lambda charges you for memory usage, lesser memory demands by your functions will lead to lesser costs to you for using AWS Lambda. * .NET Core is open-source and has been validated against Amazon Linux - the underlying platform for AWS Lambda making it very possible for AWS to respond to security issues that might arise with using it. * Lastly and more importantly, with .NET Core, you can now write your C# code on any platform as opposed to earlier days with .NET where you could write C# code on only Windows environments
There are many programming options for building your application on AWS Lambda but .Net Core has a few very important qualities that make up a solid case for picking C# over the alternatives.
The only way for your business to be healthy is for your incomes to outpace your costs. It is therefore key to be able to deliver small pieces of functioning software and get immediate feedback from your customers. I advise you to break down your work in many Plan-Do-Check-Adjust to get the shortest lead time:
In the context of AWS Lambdas, one of the most important aspects is to check the results, using the before-and-after metrics. Since Amazon manages the underlying hardware and software infrastructure, the established profiling and monitoring tools are of no practical use. There is no need to know how much RAM or CPU is available on the server to execute your functions. Instead, you should focus on monitoring the upper layers of the stack like invocation counts, durations, memory usage, and cost.
Function Handler is an entry point to start execution of the lambda function. It takes input data as the first parameter and lambda context as the second parameter. If you have long-running computation task you can take advantage of Async lambda functions. Refer AWS Lambda Developer Guide for more details.
The context object is passed as the second parameter to the handler. Context object provides useful information about AWS Lambda runtime. This could be used within the function to control the execution of AWS function.
A properly designed function should have an appropriate logging mechanism. AWS Lambda writes all logs to Cloud Watch. which could be used for analysis/troubleshooting if required. There are three ways to write logs in AWS function.
In the event of an unhandled error, an exception is sent back in Payload and logged to CloudWatch. You can look through exceptions logged by function in cloud watch.