https://github.com/jcmdsbr/poc-aspnetcore-aws-lambda
Sample of a aws lambda web api
https://github.com/jcmdsbr/poc-aspnetcore-aws-lambda
aspnetcore aws aws-apigateway aws-lambda aws-lambda-api aws-lambda-csharp aws-s3
Last synced: about 2 months ago
JSON representation
Sample of a aws lambda web api
- Host: GitHub
- URL: https://github.com/jcmdsbr/poc-aspnetcore-aws-lambda
- Owner: jcmdsbr
- Created: 2019-08-07T02:30:13.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-08-26T21:01:54.000Z (over 2 years ago)
- Last Synced: 2025-01-27T07:30:02.996Z (4 months ago)
- Topics: aspnetcore, aws, aws-apigateway, aws-lambda, aws-lambda-api, aws-lambda-csharp, aws-s3
- Language: C#
- Homepage:
- Size: 13.7 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Sample Serverless Application hosted by AWS Lambda :sunglasses:
- This project shows how to run an ASP.NET Core Web API project as an AWS Lambda exposed through Amazon API Gateway.
## Give a Star! :star:
If you liked the project, please give a star ;)
## You need some of the fallowing tools :exclamation:
- Visual Studio 2019 or Visual Studio Code
- .Net Core 2.X## Description :books:
To integrate the AWS SDK for .NET with the dependency injection system built into ASP.NET Core the NuGet package [AWSSDK.Extensions.NETCore.Setup](https://www.nuget.org/packages/AWSSDK.Extensions.NETCore.Setup/) is referenced. In the Startup.cs file the Amazon S3 client is added to the dependency injection framework. The S3ProxyController will get its S3 service client from there.
```csharp
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddAWSService();
}
```### Application Load Balancer :bulb:
To configure this project to handle requests from an Application Load Balancer instead of API Gateway change
the base class of `LambdaEntryPoint` from `Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFunction` to
`Amazon.Lambda.AspNetCoreServer.ApplicationLoadBalancerFunction`.## Startup :heavy_check_mark:
Once you have edited your template and code you can deploy your application using the [Amazon.Lambda.Tools Global Tool](https://github.com/aws/aws-extensions-for-dotnet-cli#aws-lambda-amazonlambdatools) from the command line.
Install Amazon.Lambda.Tools Global Tools if not already installed.
```sh
dotnet tool install -g Amazon.Lambda.Tools
```If already installed check if new version is available.
```sh
dotnet tool update -g Amazon.Lambda.Tools
```Execute unit tests
```sh
cd "LambdaShoppingListWebAi/test/LambdaShoppingListWebAi.Tests"
dotnet test
```Deploy application
```sh
cd "LambdaShoppingListWebAi/src/LambdaShoppingListWebAi"
dotnet lambda deploy-serverless
```