Roadmap › Amazon Web Services (AWS) for .NET and Full Stack Developers › Module: Compute
Lessons in this course (9)
2. EC2, Elastic Beanstalk, ECS/Fargate, EKS, App Runner and Lambda
Basic★ Must knowLesson 2 of 9
| Service | You manage | Good for .NET |
|---|---|---|
| EC2 | VM: OS, IIS/Kestrel, patches, scaling (Auto Scaling groups) | Lift-and-shift .NET Framework/IIS apps (Windows AMIs) |
| Elastic Beanstalk | Just upload the app; Beanstalk creates EC2, load balancer, auto scaling | Quick hosting of ASP.NET Core (Linux) or .NET Framework on IIS (Windows) |
| App Runner | Container image or source; fully managed HTTPS service | Simple containerised APIs |
| ECS + Fargate | Container task definitions and services; no servers | Most containerised .NET microservices |
| EKS | Kubernetes cluster (managed control plane) | Teams standardised on Kubernetes |
| Lambda | Functions; pay per request and duration; scales to zero | Event-driven code, APIs with spiky traffic |
bash
# ASP.NET Core on Lambda behind API Gateway (Amazon.Lambda.AspNetCoreServer.Hosting)
dotnet new install Amazon.Lambda.Templates
dotnet new serverless.AspNetCoreMinimalAPI -n ShopApi
# Program.cs: builder.Services.AddAWSLambdaHosting(LambdaEventSource.HttpApi);
dotnet lambda deploy-serverlesscsharp
// A plain Lambda function handler (S3 upload event → create thumbnail)
public class Function
{
public async Task Handler(S3Event evt, ILambdaContext ctx)
{
foreach (var record in evt.Records)
ctx.Logger.LogInformation($"New file {record.S3.Object.Key} in {record.S3.Bucket.Name}");
}
}Auto Scaling: EC2 Auto Scaling groups or ECS service auto scaling based on CPU, request count or SQS queue depth; place instances/tasks in multiple AZs behind an ALB.