Getting Started with AWS Lambda C# Functions

For those of us that are .NET developers at heart, we have powerful tools for running serverless C# applications on AWS. AWS Lambda now officially supports .NET 10 as a managed runtime, providing long-term support (LTS) through November 2028.

Modern C# support in Lambda has evolved beyond early .NET Core. Developers can now utilize C# File-Based apps, which eliminate much of the traditional boilerplate code. These functions typically publish as Native AOT (Ahead-of-Time) by default, offering up to an 86% improvement in cold start times by removing the need for JIT compilation at runtime.

Prerequisites:

  1. Development Environment: Visual Studio 2022 (latest version) with the .NET 10 SDK installed.
  2. AWS Toolkit for Visual Studio: Install the latest extension from the Visual Studio Marketplace. It now includes Amazon Q Developer for AI-assisted coding and one-click publishing.

Getting Started with the .NET CLI:

The fastest way to scaffold a new function is using the Amazon Lambda Templates. You can install and create a file-based function with these commands:


dotnet new install Amazon.Lambda.Templates
dotnet new lambda.FileBased -n MyLambdaFunction

Key Project References:

  • Amazon.Lambda.Core: The foundational library for Lambda functions.
  • Amazon.Lambda.RuntimeSupport: Required for file-based apps and Native AOT.
  • Amazon.Lambda.Serialization.SystemTextJson: High-performance JSON serialization using source generators.

Using the AWS Toolkit, you can right-click your project and select "Publish to AWS Lambda" to deploy instantly. The toolkit handles the complexity of Native AOT container builds automatically if Docker is installed on your machine.

Author’s Note: This article reflects my personal professional experience and opinions. While my insights are informed by my professional history, these views are my own and do not represent the official position of my former employer.

About the Author: Jacob Marks is an engineering leader with over 20 years of experience, including a decade at Amazon Web Services (AWS) where he led teams in EC2 Core Platform and the development of the AWS Payment Cryptography service.

Labels

.NET .NET 10 .NET 3.5 Active Directory AD DS Adoption AI AI coding AI Ethics AI Hype Alerts Amazon Cognito Amazon DLM Amazon Q Anthropic AppDomain Architecture Artificial Intelligence Asia Pacific Sydney ASP.net ASPxGridView Audit Readiness Auto Recovery Automation AWS AWS Certified AWS Lambda AWS Payment Cryptography AWS SDK AWS Security Specialty Azure Azure DevOps Server Backup BIG-IP C# Career Growth Cartes Bancaires CB Certificate Bundle Certification Claude Cloud Cloud Certification Cloud Hosting Cloud Security CloudWatch CLR Content Query Cost Optimization Credentials CyberChef Database Defense Industry Deloitte Developer Tools Developers DevEx DevExpress DevOps DISA Disk Space DISM Distributed Systems DoD DoD CC SRG DUKPT EBS EC2 Engineering Engineering Leadership Engineering Management EnPasFltV2 Enterprise Event Receiver Exam F5 Federal IT FedRAMP Fintech FISMA GAC Generative AI GitHub gMSA GovCloud Government Compliance GridView Hardware Security Modules HSM IAM Identity Management IIS Infra Infrastructure as Code IT Tools Jacob Marks JavaScript jQuery Lambda Leadership Linqpad LLM lsass.exe LTM Memory Optimization Mentorship Microsoft Migration Multi-Region Keys NACL Native AOT Network Architecture Networking NIST ODBC Open Source Payment Cryptography Payments PCI Compliance Performance Platform Platform Architecture Power Tools PowerShell Python re:Invent Reachability Analyzer Redshift Relationships List Replace Root Volume SAA-C00 SAP-C00 Security Security Group Serverless SES SharePoint SharePoint 2010 Site Reliability SMTP Snapshot Software Engineering Solutions Architect Solutions Architect Professional SP 2007 SPAWAR SSL STIG Storage Strategy Sydney SysAdmin Team Foundation Server Team Utilities Tech Industry Technical Depth Technology TFS Tools Troubleshooting Upgrade Visual Studio VPC VPC Flow Logs Web Development WebPart WinDirStat Windows Server Windows Server 2025 WinForms