https://github.com/hannahchan/serverless.webapi
A serverless experiment using AWS Lambda and ASP.NET Core.
https://github.com/hannahchan/serverless.webapi
aws dotnet lambda serverless
Last synced: 12 months ago
JSON representation
A serverless experiment using AWS Lambda and ASP.NET Core.
- Host: GitHub
- URL: https://github.com/hannahchan/serverless.webapi
- Owner: hannahchan
- License: mit
- Archived: true
- Created: 2019-03-11T12:28:08.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2021-03-09T10:43:34.000Z (about 5 years ago)
- Last Synced: 2025-02-23T22:20:57.721Z (about 1 year ago)
- Topics: aws, dotnet, lambda, serverless
- Language: C#
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Serverless.WebApi
Serverless.WebApi is an experiment in deploying an ASP.NET Core WebApi as a serverless application to AWS Lambda. It is intended to be used as an example for learning purposes.
## Prerequisites
- An AWS account with programmatic access enabled
- A S3 bucket to store your deployment packages
- [AWS Extensions for .NET CLI](https://github.com/aws/aws-extensions-for-dotnet-cli)
You can quickly install the AWS Extensions for .NET CLI for this project by running;
```
dotnet tool restore
```
## How this works
In short a package, `Amazon.Lambda.AspNetCoreServer` is installed in the WebApi project and a separate application entry point using this package, [_LambdaEntryPoint.cs_](Sources/Serverless.WebApi/LambdaEntryPoint.cs) is created for AWS Lambda. AWS Lambda uses this entry point to your application instead of the conventional [_Program.cs_](Sources/Serverless.WebApi/Program.cs). The WebApi is configured and deployed as a serverless application by using a AWS Serverless Application Model (SAM) [template](Sources/Serverless.WebApi/template.json).
## Deploying the WebApi as a Serverless Application
Change into the [project directory](Sources/Serverless.WebApi) of the WebApi and run;
```
dotnet lambda deploy-serverless
```
By default this command reads values provided in the file [_aws-lambda-tools-defaults.json_](Sources/Serverless.WebApi/aws-lambda-tools-defaults.json). If there are any required values that are missing, you will be prompted for them.
## More Resources
- [AWS Lambda for .NET Core](https://github.com/aws/aws-lambda-dotnet)
- [AWS Serverless Application Model (AWS SAM)](https://github.com/awslabs/serverless-application-model)
- [SAM CLI](https://github.com/awslabs/aws-sam-cli)