Getting Started with AWS Lambda C# Functions

For those of us that are .NET developers at heart, we finally have the ability to run server-less C# applications on AWS! Support for the C# Language in AWS Lambda was announced at AWS re:Invent 2016 (1-Dec-2016). This post is a quick getting started guide to help you get started.

C# support in Lambda requires use of .NET Core targeted assemblies as the Core CLR offers cross platform support enabling the Linux based Lambda infrastructure to execute .NET complied binaries. Lambda accepts the zipped build output of .NET Core targeted class library rather than raw code for C# Lambda fucntions. Function handlers are referenced using he syntax <Assembly Name>::<Fully Qualified Class Name>::<Method Name>. Which in the case of a project with output assembly named "myassembly", a namespace of "myassemblynamespace", a class named "myclass" and a method named "mymethod" would be "myassembly::myassemblynamespace.myclass::mymethod". AWS Provides a project type and tooling through its Toolkit for Visual Studio that enable creation of C# Lambda functions however you can build your own from a standard class library project.

Prerequisites:

  1. Development Environment (See .NET Core Installation Guide)
    • Visual Studio 2015 with Update 3
    • .NET Core Tools
  2. AWS Visual Studio IDE ToolKit
    • AWS SDK for .NET (v3.3.27.0 or greater required)
    • AWS Toolkit for Visual Studio (v1.11.0.0 or greater required)

Required Project References:

  • Amazon.Lambda.Core (Install-Package Amazon.Lambda.Core)
  • Amazon.Lambda.Serialization.Json (Install-Package Amazon.Lambda.Serialization.Json)
  • Amazon.Lambda.Tools (Install-Package Amazon.Lambda.Tools -Pre)

NOTICE: All thoughts/statements in this article are mine alone and do not represent those of Amazon or Amazon Web services. All referenced AWS services and service names are the property of AWS. Although I have made every effort to ensure that the information in this article was correct at writing, I do not assume and hereby disclaim any liability to any party for any loss, damage, or disruption caused by errors or omissions, whether such errors or omissions result from negligence, accident, or any other cause.