.NET Core AWS Lambda Multiple Function in Single Project

Few days ago I decided to create my own email marketing tool on serverless architecture. I mostly use .NET Core if it is reasonable enough to use it. After created my first function, I switched from ‘aws-lambda-tools-defaults.json’ to ‘serverless.template’ file to use multiple functions in single .NET Core project with Visual Studio. Here is how is done.

Source Repo! You can find fully functional sample built on .NET Framework of this post at GitHub repository .NET-Core-AWS-Lambda-Multiple-Function-in-Single-Project

Create Project

In order to do that you need to install AWS Toolkit for Visual Studio. Then create new project as ‘AWS Lambda Project (.NET Core)’.

Image for post
Image for post

And choose ‘Empty Function’, click ‘Finish’.

Image for post
Image for post


As you see on default configuration there is space for one function handler. Even if you add another function to ‘Function.cs’ you wont be able to see it on Mock tool.

But I want to code multiple functions in single project of class.


To use multiple functions in single project we need serverless.template and reference from ‘aws-lambda-tools-defaults.json’ file. You can add template file by simply right-click to project and Add>AWS Serverless Template.

First we need to delete function handler references ‘aws-lambda-tools-defaults.json’ and add referencet to template.

In template file we need to set references to all function handler with different name under Recources.

That’s it.

I hope this post has helped you.

Originally published at irensaltali.com on January 13, 2019.

Written by

MSc. Computer Engineer. Founder of @noteducom and @image4io, co-organizer in @serverlesstr, Community Builder of @awscloud

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store