.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 for Converge360.

comments powered by Disqus


  • AI for GitHub Collaboration? Maybe Not So Much

    No doubt GitHub Copilot has been a boon for developers, but AI might not be the best tool for collaboration, according to developers weighing in on a recent social media post from the GitHub team.

  • Visual Studio 2022 Getting VS Code 'Command Palette' Equivalent

    As any Visual Studio Code user knows, the editor's command palette is a powerful tool for getting things done quickly, without having to navigate through menus and dialogs. Now, we learn how an equivalent is coming for Microsoft's flagship Visual Studio IDE, invoked by the same familiar Ctrl+Shift+P keyboard shortcut.

  • .NET 9 Preview 3: 'I've Been Waiting 9 Years for This API!'

    Microsoft's third preview of .NET 9 sees a lot of minor tweaks and fixes with no earth-shaking new functionality, but little things can be important to individual developers.

  • Data Anomaly Detection Using a Neural Autoencoder with C#

    Dr. James McCaffrey of Microsoft Research tackles the process of examining a set of source data to find data items that are different in some way from the majority of the source items.

  • What's New for Python, Java in Visual Studio Code

    Microsoft announced March 2024 updates to its Python and Java extensions for Visual Studio Code, the open source-based, cross-platform code editor that has repeatedly been named the No. 1 tool in major development surveys.

Subscribe on YouTube