Monitoring platform for keeping systems up and running at all times.
Full stack visibility across the entire stack.
Detect and resolve any incident in record time.
Conform to industry best practices.
The world of cloud computing has been revolutionized by a solution called serverless computing. It has been an absolute joy for developers to use.
Before this innovation, developers had to worry about the resources powering their code. Since the launch of serverless computing, the developer’s focus on operating-system and hardware architecture is now a thing of the past. It handles all the server management while focusing on what you do well — writing good quality code.
This article will explain how to build serverless functions on the primary cloud providers services: Azure and AWS.
If you are new to serverless computing or need to dig deep into the origins and evolutions of serverless, check out this article.
Two essential prerequisites need to be met to build serverless Azure Functions applications with C#:
As a C# developer, you are already familiar with the various tools for building your applications, including Visual Studio Code and Visual Studio IDE. Both tools help create applications with Azure Functions, depending on whichever one you are most comfortable with. Let’s dig a little deeper into these two tools.
Visual Studio Code is a lightweight but powerful code editor with different versions available for Windows, Linux, and macOS.
To build apps for Azure functions, you will need to get Azure Tools for Visual Studio Code which will give you convenient commands to access or create resources directly from the VS Code editor.
To set up Azure Tools, install the Azure Extension Pack by firing up your editor and navigating to the extension marketplace on the left side menu. The extension marketplace interface in VS Code should look like this:
When you are done with the setup of Azure for VS Code, log in to Azure from the code editor by firing the Command Palette with the commands CTRL+Shift+P and typing “Azure: Login” in the text field that appears. Click the corresponding result that appears, and a code will be generated by the editor with instructions on how to complete the process.
Another vital extension if you will be developing in C# with VS Code is the C# for Visual Studio Code. As of the time of this writing, the extension supports basic debugging capabilities, full details of which can be found here.
From version 15.5, the Azure Development workload comes bundled with Azure Functions tools. This implies if you plan on installing the latest version of Visual Studio 2019, you need to include Azure Development workload in your installation process.
Once installation is complete, sign in to your Microsoft account in Visual Studio and create a new Azure Functions project, and you are good to go.
Now that we’ve highlighted what you need to know if you want to build serverless functions in C# with Azure functions, let’s move over to discussing what you need to begin running serverless apps on the AWS Lambda serverless framework
AWS Lambda is the compute part of the AWS serverless architecture and requires almost zero administration. It is one of the most popular options for serverless, and though AWS launched it in 2014, in 2018, AWS announced official support for a .NET Core 2.0 runtime, and in 2020 for version 3.1. It is crucial to understand that .NET Core is different from the .NET framework, and here are a few reasons AWS chose .NET Core over the .NET framework
To begin building Lambda functions in C# with Visual Studio, you will need to understand AWS Lambda has a laid-down pattern for authoring code for your Lambda function. This pattern includes the following concepts:
Now that we know the framework for writing for AWS Lambda, let’s see how all this works together.
A few prerequisites are required to begin writing code for Lambda functions:
Once you’ve installed all prerequisites, open Visual Studio and fill in the AWS credentials on the Getting Started with the AWS Toolkit for Visual Studio window displayed next to the Start Page tab. The credentials (Access Key and Secret Key) can be obtained by following the instructions outlined in the window.
With all set, let’s move on to build our Lambda project.
A critical file created with your project is the aws-lambda-tools-defaults.json file, where you set your function handler and other options.
aws-lambda-tools-defaults.json
The contents of the file should look like this:
{ "Information": [ "This file provides default values for the deployment wizard inside Visual Studio, and the AWS Lambda commands added to the .NET Core CLI.", "To learn more about the Lambda commands with the .NET Core CLI execute the following command at the command line in the project root directory.", "dotnet lambda help", "All the command line options for the Lambda command can be specified in this file." ], "profile": "default", "region": "us-east-2", "configuration": "Release", "framework": "netcoreapp3.1", "function-runtime": "dotnetcore3.1", "function-memory-size": 256, "function-timeout": 30, "function-handler": "AWSLambda1::AWSLambda1.Function::FunctionHandler" }
The next step to running our code on AWS Lambda is to publish it. This is done after the code has been reviewed and you are convinced it is good to go. The following steps outline what you need to do to get your code published.
Now, you have a quick peek into what you need to know to build and publish serverless applications with the powerful C# programming language, and though at Dashbird, we are more inclined towards AWS Lambda, nothing is stopping you from exploring both the Microsoft Azure functions and AWS Lambda options in getting that serverless infrastructure for your applications.
Further reading:
How to get an overview of C# Lambda functions
AWS vs Azure, a quick comparison
Serverless observability and real-time troubleshooting
In this guide, we’ll talk about common problems developers face with serverless applications on AWS and share some practical strategies to help you monitor and manage your applications more effectively.
Today we are announcing a new, updated pricing model and the end of free tier for Dashbird.
In this article, we’re covering 4 tips for AWS Lambda optimization for production. Covering error handling, memory provisioning, monitoring, performance, and more.
Dashbird was born out of our own need for an enhanced serverless debugging and monitoring tool, and we take pride in being developers.
Dashbird gives us a simple and easy to use tool to have peace of mind and know that all of our Serverless functions are running correctly. We are instantly aware now if there’s a problem. We love the fact that we have enough information in the Slack notification itself to take appropriate action immediately and know exactly where the issue occurred.
Thanks to Dashbird the time to discover the occurrence of an issue reduced from 2-4 hours to a matter of seconds or minutes. It also means that hundreds of dollars are saved every month.
Great onboarding: it takes just a couple of minutes to connect an AWS account to an organization in Dashbird. The UI is clean and gives a good overview of what is happening with the Lambdas and API Gateways in the account.
I mean, it is just extremely time-saving. It’s so efficient! I don’t think it’s an exaggeration or dramatic to say that Dashbird has been a lifesaver for us.
Dashbird provides an easier interface to monitor and debug problems with our Lambdas. Relevant logs are simple to find and view. Dashbird’s support has been good, and they take product suggestions with grace.
Great UI. Easy to navigate through CloudWatch logs. Simple setup.
Dashbird helped us refine the size of our Lambdas, resulting in significantly reduced costs. We have Dashbird alert us in seconds via email when any of our functions behaves abnormally. Their app immediately makes the cause and severity of errors obvious.