Lambda

AWS Lambda Simplicity with .NET Top-level Statements

The .NET 6 runtime for AWS Lambda gave .NET developers a few more options when developing AWS Lambda functions. One such option is top-level statements. The top-level statements feature was designed to greatly simplify developing applications in C# by removing a lot of the “boilerplate” code.  For instance, in this tutorial we will utilize a console application to develop an AWS Lambda function and in this console application you will notice that our Program.cs file does not have a Main function or even a namespace statement. Checkout Microsoft’s tutorial on top-level statements to learn more.

AWS Lambda Powered by ASP.NET Core Minimal APIs

Often touted as a solution for microservices, Minimal APIs are a new feature in ASP.NET Core that allows developers to easily create HTTP based APIs with minimal dependencies. On top of that, ASP.NET Core minimal APIs are simple, only requiring a csproj file and a Program.cs file.

Photo by Jakub Mičuch on Unsplash

The Solution

In this tutorial, well take a look at using ASP.NET Core minimal APIs as a way to build AWS Lambda functions. We’ll first develop the ASP.NET Core minimal API and then we’ll make a small change that turns the minimal API into a Lambda Function.

Create a .NET AWS Lambda Function with an HTTPS Endpoint

Get all the code on GitHub.

AWS Lambda, the popular AWS service, has been the solution behind many microservices. Some even argue that AWS Lambda enabled the microservice trend over the last five to seven years. And, the serverless/AWS Lambda trend does not show any signs of slowing down.

Even with its popularity, there was always one missing ingredient, a URL that could directly invoke the AWS Lambda function. Some could argue that this could be accomplished through the use of AWS API Gateway along with AWS Lambda. Although, what if you don’t need everything that AWS API Gateway gives you? Or, what if you don’t want or need the hassle of AWS API Gateway? And, maybe, you’re just looking for a checkbox in the AWS Console for the Lambda configuration that enables a URL for the function? If this sounds like you, then the wait is over, because that’s just the feature that AWS recently announced for Lambda.

How to Create a Simple .NET Core AWS Lambda Function

Skip the detail and show me the solution.

AWS Lambda is one of the hottest technologies in cloud software development today. And, as hot as it is, there is still a lot of confusion on just what Lambda is and how to develop a serverless function. 

First, let’s clarify a few things, serverless doesn’t mean that there isn’t a server. It just means that you don’t have to provision, maintain, upgrade (etc.) a server in order to develop and deploy your software.