Skip to content

A cookiecutter template to create a .NET based AWS Lambda function and test using a Visual Studio folder structure and .NET 6

License

Notifications You must be signed in to change notification settings

aws-samples/cookiecutter-aws-sam-dotnet

AWS SAM Cookiecutter for .NET Lambda functions

A Cookiecutter template to create a Serverless application using the AWS Serverless Application Model Command Line Interface (AWS SAM CLI) and .NET 6.

This template follows the default directory structure of Visual Studio solutions (including a test project), and also includes core utilities - Logging, Metrics and Tracing - for the AWS Lambda Powertools for .NET. To see how to leverage all of Powertools functionality vistit the documentation https://awslabs.github.io/aws-lambda-powertools-dotnet/.

Do not git clone this project unless you want to fork it to create your own project template. To create a Serverless application from this template follow the instructions below and use the AWS SAM CLI instead.

Requirements

Cookiecutter install

Install cookiecutter command line:

  • Pip users: pip install cookiecutter
  • Homebrew users: brew install cookiecutter
  • Windows or Pipenv users: pipenv install cookiecutter

AWS SAM CLI install

To use the AWS SAM CLI, you need the following tools.

Microsoft .NET 6 install

You will need the following for local testing.

Usage

The sam init command initializes a serverless application with an AWS SAM template, or a template or application you specify. Use the location parameter to pass the location of this project

sam init --location gh:aws-samples/cookiecutter-aws-sam-dotnet

alternatively you can use Cookiecutter command:

cookiecutter gh:aws-samples/cookiecutter-aws-sam-dotnet`. 

You'll be prompted a few questions to help this cookiecutter template to scaffold this project. After it's completed, you should see a new folder at your current path with the name of the project you specified as input.

NOTE: After you understand how cookiecutter works (cookiecutter.json, mainly), you can fork this repo and apply your own mechanisms to accelerate your development process and this can be followed for any programming language and OS.

Options

Option Description
solution_name Name of the Visual Studio solution file
project_name Name of the Visual Studio project
include_safe_deployment Sends by default 10% of traffic for every 1 minute to a newly deployed function using CodeDeploy + SAM integration - Linear10PercentEvery1Minute

Credits

License Summary

This sample code is made available under a modified MIT license. See the LICENSE file.

About

A cookiecutter template to create a .NET based AWS Lambda function and test using a Visual Studio folder structure and .NET 6

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •