λ# — Accelerate Serverless Development with CloudFormation
At MindTouch, we are huge fans of serverless. AWS has made it super easy and fun to build serverless applications using the AWS Console. However, the tooling can become tedious when following an infrastructure-as-code discipline. In my opinion, versioning your infrastructure is just as important as versioning your code.
There are already a few tools out there, such as SAM, Terraform, and Serverless, but none scratched our itch. So we built a tool called Lambda Sharp — λ# for short — and open sourced it. The implementation is available on GitHub under Apache 2.0 license.
Our objectives for λ# were:
- Build and deploy a serverless application in a single command
- Leverage CloudFormation to manage deployments
- Bake in reliability and monitoring best practices
- Have a composition model for serverless applications
The first two objectives were easy. We achieved them with our initial 0.1 release. With a single command, we could build, upload, and deploy our serverless code with CloudFormation.
The next two objectives took a bit more work, but our 0.4 release establishes a solid foundation. The deployment process remains just as simple, but the deployed code and infrastructure have grown significantly in sophistication.
λ# approaches serverless development from a tooling, a coding, and a managing perspective. As a result, the effort is spread over three distinct areas:
- The λ# CLI, which is responsible for generating the CloudFormation code.
- The λ# Classes, which provide consistent message and failure handling across Lambda functions.
- The λ# Runtime, which is its own serverless application that provides services to other serverless deployments.
There is a lot to unpack about the design of λ# and I look forward sharing insights into how we made our choices. For this post though, I invite you to check out the samples and release notes. Try out λ# and share your thoughts and feedback.
Getting started is trivial. The λ# CLI is packaged as .NET Core Global Tool, which can be installed with the following command:
dotnet tool install -g MindTouch.LambdaSharp.Tool --version 0.4
After that, you need to configure the λ# CLI and initialize the λ# runtime:
dotnet lash config
dotnet lash init --tier Sandbox
Once this is done, you can create and deploy your first λ# module, which is a packaged unit of application and infrastructure code. A module can be a full-fledged serverless application or a building block for your serverless infrastructure (e.g. custom resource handler).
dotnet lash new module MyFirstModule
dotnet lash new function MyFirstFunction
dotnet lash deploy