Run your ASP.NET Minimal API on AWS Lambda in 10 minutes

  Рет қаралды 3,067

James Eastham

James Eastham

Күн бұрын

ASP.NET is a powerful technology for building web applications in .NET. .NET 6 introduce a new way of defining your API's, using the minimal API syntax. Minimal API's simplify the definition of your API endpoints and handlers.
AWS provides tooling to run your ASP.NET minimal API on AWS Lambda by adding a single line of code to your existing application. The additional code allows the same code to run on both using the Kestrel web server and with AWS Lambda when deployed into the Lambda environment.
In this video we walk through how to take an out of the box ASP.NET minimal API and deploy that on to AWS Lambda.
00:00 - Introduction
00:30 - Create a new minimal API
01:40 - Install Nuget package
02:10 - Add additional startup code
04:00 - AWS Lambda .NET Global CLI
05:10 - Deploy Function wizard
07:40 - API Gateway Configuration
09:40 - Performance
Links
Install SAM CLI - docs.aws.amazon.com/serverles...
Install .NET 6 - dotnet.microsoft.com/en-us/do...
Amazon.Lambda.AspNetCoreServer - github.com/aws/aws-lambda-dot...
Minimal API's - learn.microsoft.com/en-us/asp...
Benchmarks - github.com/aws-samples/server...
Twitter - / plantpowerjames
LinkedIn - / james-eastham
Website - serverlessdotnet.dev

Пікірлер: 8
@bo44arov
@bo44arov Жыл бұрын
thanks for this tutorial! really useful!
@serverlessjames
@serverlessjames Жыл бұрын
You're welcome!
@markcoleman8579
@markcoleman8579 Жыл бұрын
Great video James. Any chance you can increase the font size in future videos so that they're easier to view on a tablet?
@serverlessjames
@serverlessjames Жыл бұрын
Yes, absolutely. That's great feedback thanks Mark 👍
@hki6mq
@hki6mq Жыл бұрын
Hey James, any advice on how to deploy this using CDK?
@serverlessjames
@serverlessjames Жыл бұрын
There's a great blog post on the AWS blogs that talk through how to deploy .NET with the CDK ☺️ aws.amazon.com/blogs/modernizing-with-aws/build-package-publish-dotnet-csharp-lambda-functions-aws-cdk/
@stavvers
@stavvers Жыл бұрын
Hey James, great video. Question, I have done everything apart from set up a proxy. When I try to access the weatherforecast route I get a 404 and the following error when invoking from visual studio { "errorType": "NullReferenceException", "errorMessage": "Object reference not set to an instance of an object.", "stackTrace": [ "at Amazon.Lambda.AspNetCoreServer.APIGatewayHttpApiV2ProxyFunction.MarshallRequest(InvokeFeatures features, APIGatewayHttpApiV2ProxyRequest apiGatewayRequest, ILambdaContext lambdaContext)", "at Amazon.Lambda.AspNetCoreServer.AbstractAspNetCoreFunction`2.FunctionHandlerAsync(TREQUEST request, ILambdaContext lambdaContext)", "at Amazon.Lambda.RuntimeSupport.HandlerWrapper.c__DisplayClass26_0`2.d.MoveNext()", "--- End of stack trace from previous location ---", "at Amazon.Lambda.RuntimeSupport.LambdaBootstrap.InvokeOnceAsync(CancellationToken cancellationToken)" ] } Is this due to the proxy not being set up?
@serverlessjames
@serverlessjames Жыл бұрын
Great question Andy! What exactly are you passing as the input payload when you're invoking the function from Visual Studio? Under the hood, the AWS tooling is translating what it's expecting to be an API Gateway input payload into a request it can pass to ASP.NET (that's what the marshall request method does). If you invoke the function with say, a string of 'Hello World' that deseriailzed object will be null, causing an object reference error. If you @ me on twitter I can send a quick video
Should You Run An Entire Web Application in AWS Lambda?
13:19
James Eastham
Рет қаралды 1,7 М.
Building a Serverless REST API in .NET with AWS Lambda
20:13
Nick Chapsas
Рет қаралды 76 М.
Alex hid in the closet #shorts
00:14
Mihdens
Рет қаралды 19 МЛН
Little brothers couldn't stay calm when they noticed a bin lorry #shorts
00:32
Fabiosa Best Lifehacks
Рет қаралды 4,4 МЛН
Configuring AWS Credentials for  .NET Applications | .NET on AWS
28:20
Master AWS Lambda with Java 17 in Just 2 Minutes!
2:00
Carlos Chacin
Рет қаралды 649
.NET 6 Web API Authentication | Minimal API & Swagger (CRUD)
45:34
Code with Julian
Рет қаралды 76 М.
The Easiest Way to Create Serverless APIs in .NET
18:14
Nick Chapsas
Рет қаралды 40 М.
Understand Observability for Event-Driven Systems
15:09
James Eastham
Рет қаралды 306
Bluetooth connected successfully 💯💯
0:16
Blue ice Comedy
Рет қаралды 2,2 МЛН
Как удвоить напряжение? #электроника #умножитель
1:00
Hi Dev! – Электроника
Рет қаралды 1,1 МЛН
iPhone 15 Pro в реальной жизни
24:07
HUDAKOV
Рет қаралды 506 М.
Новые iPhone 16 и 16 Pro Max
0:42
Romancev768
Рет қаралды 2,4 МЛН