The RavenDB AWS Lambda C# template is a template repository on GitHub which means
you can either create a new repository derived from the template or clone and push it to a new repository.
This will set up a local Lambda C# function that we will deploy to your AWS account at the end of the guide.
Creating a New Repository from the Template
Depending on your environment, there are several ways to clone the template and initialize a new Git repository.
The template repository lists each clone method you can copy & paste directly.
npx and the degit tool if you have Node.js installed:
npx degit ravendb/templates/aws-lambda/csharp-http my-project
Using Bash or PowerShell:
git clone https://github.com/ravendb/templates my-project
git filter-branch --subdirectory-filter aws-lambda/csharp-http
rm -rf .git # Bash
rm -r -force .git # PowerShell
After cloning the repository locally, restore .NET dependencies with
By default, the template is configured to connect to the Live Test instance of RavenDB.
Since this is only for testing purposes, next you will configure the app to connect to
your existing RavenDB database.
Starting the Function
You can start the Lambda function locally using:
If you are using Visual Studio Code, you can also debug the function with F5 debugging.
You will see the welcome screen if the template is set up correctly:
.NET template welcome screen
You will need the .NET Global Tools for Lambda installed to perform the deployment steps later.
dotnet tool install -g Amazon.Lambda.Tools`
Or make sure it's updated if you already have it:
dotnet tool update -g Amazon.Lambda.Tools
Set Up Your Environment
AWS libraries, SDKs and this template rely on several environmental artifacts to work.
One is your AWS credentials, stored in
~/.aws/credentials and the other is the default AWS region to use.
Using the defaults file: You can use the template's
aws-lambda-tools-defaults.json to set your Functions region:
Using an environment variable: Set the
AWS_REGION environment variable in your terminal session or profile.
Learn more about setting up AWS credentials or the default AWS region.