Guide To Building AWS Lambda Functions with Ease in JetBrains Rider
The AWS Toolkit plugin for JetBrains Rider makes it easier to develop, debug, and deploy serverless applications with AWS right from your IDE. Learn how to setup AWS Toolkit and create AWS Lambda Functions from JetBrains Rider IDE.
Table of Contents
The AWS Toolkit plugin for JetBrains Rider makes it easier to develop, debug, and deploy serverless applications with AWS right from your IDE.
In this blog post, let's learn how to set up the AWS Toolkit and create AWS Lambda Functions from JetBrains Rider IDE.
Install AWS Toolkit For JetBrains Rider
The AWS Toolkit is available in the JetBrains marketplace. You can install this from within the Rider IDE, by navigating to Settings → Plugins section and searching for 'AWS Toolkit'.
Once installed you can see an additional icon, with the AWS logo (as shown in the screenshot below) on the left sidebar.
The Toolkit automatically picks up the AWS connection strings from the configuration file.
We learned how to set up the AWS credentials in an earlier article on Learn How To Manage Credentials When Building .NET Application on AWS.
Create Lambda Functions in JetBrains Rider
With the AWS Toolkit installed, we now have additional template options to create .NET projects.
We can create different starter templates for building AWS Lambda Functions.
Create an Empty Lambda Function in JetBrains Rider
To create an empty Lambda Function, search for 'Lambda Empty Function' template under the 'Add New Project' dialog in Rider.
Once you fill in the required Solution Name, Project Name, and the solution directory it generates a default Lambda Function .NET project, with the below FunctionHanlder
Lambda function.
public string FunctionHandler(string input, ILambdaContext context)
{
return input.ToUpper();
}
AWS Services and Lambda Function in JetBrains Rider
The AWS Toolkit for Rider also provides additional Lambda templates that you can use as starter templates when building applications.
Based on your application and the different AWS Service you are integrating with, you can choose appropriate starter templates.
Below is an example of creating a Lambda Simple SQS Function template.
The template generates the required code to handle SQSEvents
in the AWS Function Handler.
public async Task FunctionHandler(SQSEvent evnt, ILambdaContext context)
{
foreach (var message in evnt.Records)
{
await ProcessMessageAsync(message, context);
}
}
private async Task ProcessMessageAsync(
SQSEvent.SQSMessage message, ILambdaContext context)
{
context.Logger.LogInformation($"Processed message {message.Body}");
// TODO: Do interesting work based on the new message
await Task.CompletedTask;
}
If you want to learn more about integrating with different AWS Services when building Lambda Functions check out my below blog post.
Debugging Lambda Function from JetBrains Rider
The Mock Lambda Tool helps test the Lambda function locally without deploying it to an AWS environment.
You can set up the Mock Lambda Test Tool to work with Rider in two ways
- Using Rider .run file
- Using launchsettings.json file
You can learn more in my blog post on How To Set Up AWS .NET Mock Lambda Test Tool on JetBrains Rider.
Rahul Nath Newsletter
Join the newsletter to receive the latest updates in your inbox.