Pre-requisites

  • An active AWS account
  • Visual Studio
  • AWS Toolkit for Visual Studio
  • ASP.NET Core 6 or higher

Steps

Create ASP.NET Core Web API project.
Install Amazon.Lambda.AspNetCoreServer.Hosting NuGet package.
Add a call to AddAWSLambdaHostingmethod when services are defined in your application.
C#
Copy
// Add AWS Lambda support. builder.Services.AddAWSLambdaHosting(LambdaEventSource.HttpApi); var app = builder.Build();
Open .csproj file and add the following tag in the PropertyGroup section.
XML
Copy
<AWSProjectType>Lambda</AWSProjectType>