News

.NET 6 Runtime for AWS Lambda Unveiled

Amazon Web Services recently introduced the .NET 6 runtime for AWS Lambda, which means .NET-centric cloud coders can now do their serverless computing projects with the latest edition of Microsoft's open source developer platform, which debuted almost four months ago.

"You can now use the .NET 6 runtime to build AWS Lambda functions," AWS said in a Feb. 24 blog post. "The new managed runtime supports both x86 and Arm/Graviton2 processors. You can get started with .NET 6 and Lambda using your tool of choice, including Visual Studio 2022 with the AWS Toolkit for Visual Studio, the .NET CLI with the Amazon.Lambda.Tools global tool, and the AWS Serverless Application Model CLI (AWS SAM CLI)."

Amazon has extensive .NET on AWS documentation that provides all kinds of information on how Microsoft's flagship runtime/developer platform can be used in the AWS cloud, including serverless, event-driven computing.

AWS documentation, for example, shows how an old monolithic .NET REST API project was migrated to AWS Lambda, going from this:

Architecture of the Deployed Monolithic Application
Architecture of the Deployed Monolithic Application (source: AWS).

to this:

Architecture of the Deployed Monolithic Application
[Click on image for larger view.] Architecture After Migrating to Lambda (source: AWS).

which results in a hexagonal architecture pattern:

The Hexagonal Architecture Pattern
[Click on image for larger view.] The Hexagonal Architecture Pattern (source: AWS).

AWS .NET 6 support on AWS documentation says: "You can run .NET 6 applications, targeting x86_64 or ARM64 (AWS Graviton2), on AWS Lambda using any of the following options:

  • Managed Runtime - This option uses a .zip file archive for the deployment package.
  • Managed base container image - Pull from the ECR Public Gallery or use .NET 6 container image Blueprint in the AWS Toolkit for Visual Studio.
  • Custom container image - Build a container image with the .NET 6 application packaged inside it. This PowerShell script will build a .NET 6 base container image.
  • Custom runtime - The custom runtime bundles all necessary .NET 6 libraries in the zip file archive that is deployed to Lambda, see this example. For an ARM64 see this example.

In addition to being able to use the latest languages -- C# 10 and F# 6 -- AWS said its serverless developers can now avail themselves of a host of other .NET 6 features including:

  • Improved logging
  • Using source generator for JSON serialization
  • Top-level statements
  • ASP.NET Core minimal APIs

AWS also noted the switch to an open source Lambda runtime client, one of many projects that Amazon has open sourced and placed in the aws/aws-lambda-dotnet GitHub repository over the past few years. Previously, the open source runtime client was used only in certain scenarios, specifically for functions that used Lambda's custom runtime or container-image based support.

"Now you have a consistent and transparent Lambda runtime client experience in all environments whether that is the managed runtime, container images or using the Lambda runtime client for .NET custom runtimes," AWS said. "The switch from the previous runtime client to the open source runtime client is transparent as Lambda functions are migrated to .NET 6."

The post also provides instructions for migrating to .NET 6.

"We are excited to add support for .NET 6 to Lambda," AWS said in conclusion. "It's fast to get started or migrate existing functions to .NET 6, with many new features in .NET 6 to take advantage of. Read the Lambda Developer Guide for more getting started information.

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube