Covers .NET 10 on AWS Lambda (managed dotnet10 runtime, cold starts, Native AOT, SnapStart, ASP.NET Core hosting), ECS on Fargate versus EKS for containers, and RDS for SQL Server (licensing, Multi-AZ, limits), with when to choose each.
On AWS I'd pick the compute by workload shape. Lambda has a managed dotnet10 runtime; it suits spiky, event-driven work (SQS, S3 events, schedules) and can host a whole Minimal API with Amazon.Lambda.AspNetCoreServer.Hosting. Its costs are cold starts, which Native AOT or SnapStart reduce, and a 15-minute limit.
For a steady containerised API, ECS on Fargate is the default: no nodes, an ALB in front, task roles for identity. EKS is managed Kubernetes; I'd only choose it when we need Kubernetes portability or already run a platform team.
For the database, RDS for SQL Server keeps EF Core and T-SQL unchanged, with Multi-AZ and automated backups, but licence-included SQL Server is expensive and you lose sysadmin. The trade-off is ops effort against control and cost at steady load.
"I'd start from the shape of the workload. For event-driven or spiky work, like processing SQS messages, reacting to S3 uploads or running scheduled jobs, I'd use Lambda. AWS added a managed
dotnet10runtime in January 2026, so I can deploy .NET 10 functions directly, or ship a container image. A function runs for at most 15 minutes and can have up to about 10 GB of memory, and CPU scales with memory. The cost to manage is the cold start: a JIT-compiled .NET function with the AWS SDK and DI can take several hundred milliseconds to over a second to start. I reduce that with Native AOT on a custom runtime, SnapStart, which restores a snapshot of an initialised function, trimming dependencies, or provisioned concurrency when latency really matters.For a steady HTTP API, I'd containerise it and run it on ECS with Fargate. There are no nodes to patch; I define a task definition with CPU, memory and an IAM task role, put an Application Load Balancer in front, and let ECS service auto scaling add tasks on CPU or request count. EKS gives me managed Kubernetes, which is worth it if the organisation already has a platform team, Helm charts and GitOps, or needs portability across clouds. Otherwise it's a lot of operational surface for one team.
For data, RDS for SQL Server means EF Core migrations and our T-SQL work unchanged. I get automated backups, point-in-time restore and Multi-AZ failover. What I give up is
sysadmin, some instance-level features, and money: licence-included Enterprise edition, Multi-AZ, is one of the most expensive lines on an AWS bill. The mistake I see is putting a latency-sensitive, always-busy API on Lambda because 'serverless is cheaper'. Above steady load, Fargate is usually both cheaper and faster."
| Option | What you manage | Scaling | Best for | Not for |
|---|---|---|---|---|
| Lambda (dotnet10) | Code and config | Per request, to zero | Events, queues, schedules, spiky APIs | Long jobs (>15 min), steady high load, WebSockets with state |
| App Runner | Container image | Requests, to minimum 1 | Small web apps, low ops | Complex networking, fine-grained scaling |
| ECS on Fargate | Task definitions, ALB | Service auto scaling | Containerised APIs and workers | Teams standardised on Kubernetes |
| ECS on EC2 | Plus the instances | Capacity providers | Cost-optimised steady load, GPUs | Teams without ops capacity |
| EKS | Kubernetes manifests, add-ons, nodes (or Fargate / Auto Mode) | HPA, Karpenter | Platform teams, multi-cloud portability | One small team, one service |
| Technique | Effect | Cost |
|---|---|---|
Native AOT (custom runtime provided.al2023) |
Largest cold start reduction | Trimming and reflection limits; build on Linux |
| SnapStart | Restores from a snapshot after init | Must handle uniqueness (random seeds, connections) after restore |
| Provisioned concurrency | Pre-warmed instances | You pay while idle |
| Higher memory | More CPU, faster init | Higher GB-second price |
| Fewer dependencies, lazy init | Less work at start-up | Code discipline |
| You get | You give up |
|---|---|
| Automated backups, point-in-time restore | sysadmin, OS access |
| Multi-AZ synchronous standby, automatic failover | Some features (for example certain instance-level configuration) |
| Patching windows | Licence cost: licence-included pricing per vCPU-hour |
| Same EF Core provider and T-SQL | Scaling storage and instance size causes brief disruption |
A team ran an invoice-generation API on Lambda with JIT: p99 latency was [2.1 s] on cold starts at 9 am. Moving the request path to ECS on Fargate with 2–6 tasks gave a steady p99 of [180 ms] and cost [30%] less at their volume, while the nightly PDF batch stayed on Lambda triggered by SQS, where cold starts did not matter.
Checks whether the candidate can match .NET workloads to AWS compute and data services on latency, duration, cost and operational effort.
Green flags
Red flags
Invoke ─▶ Lambda service ─▶ execution environment (Firecracker microVM)
├─ INIT: start runtime, load assemblies, run constructor / DI
├─ INVOKE: call handler(event, context)
└─ stays warm for later invokes, then frozen / recycled
A cold start is the INIT phase: starting the .NET runtime, JIT-compiling start-up code, building the DI container and creating SDK clients. A warm environment skips it. One environment handles one request at a time, so concurrency equals the number of environments.
With the managed dotnet10 runtime you deploy a zip with dotnet lambda deploy-function (Amazon.Lambda.Tools). With a custom runtime (provided.al2023) you ship a Native AOT binary and use Amazon.Lambda.RuntimeSupport to poll the Runtime API yourself; there is no JIT, so start-up is much faster, but reflection-heavy libraries need trimming-safe alternatives (source-generated System.Text.Json).
SnapStart runs INIT once at publish time, snapshots the memory, and restores from it. Anything that must be unique per environment (random seeds, cached credentials with expiry, open connections) must be re-created after restore using runtime hooks.
Amazon.Lambda.AspNetCoreServer.Hosting adds builder.Services.AddAWSLambdaHosting(LambdaEventSource.HttpApi). It translates API Gateway or function URL events into HttpContext, so the same Minimal API runs locally with Kestrel and in Lambda. It is convenient, but every cold start builds the whole ASP.NET Core pipeline.
Route 53 ─▶ ALB (HTTPS, target group health checks)
└─▶ ECS service (desired count 2..10)
└─ tasks on Fargate: container image from ECR
task role ─▶ S3, SQS, Secrets Manager
execution role ─▶ pull image, write logs
Key pieces: the task definition (image, CPU and memory, env vars, secrets from Secrets Manager, log driver), the task role used by your code, and the execution role used by ECS itself. Rolling deployments replace tasks behind the ALB; CodeDeploy can do blue-green.
For .NET in a container, remember that the GC sees the container's memory limit; set DOTNET_GCHeapHardLimitPercent if you need headroom for native memory.
AWS runs the control plane; you run nodes (managed node groups, Karpenter, Fargate profiles or EKS Auto Mode). You add the AWS Load Balancer Controller for ingress and EKS Pod Identity (or IRSA) so pods get IAM roles. It is powerful and portable, and it is a platform you have to own: upgrades every Kubernetes minor release, add-on versions, cluster security.
RDS runs SQL Server on managed instances. Multi-AZ keeps a synchronous standby in another Availability Zone and fails over by switching DNS, usually within one to two minutes, so your .NET connection must retry (EnableRetryOnFailure in EF Core). Backups give point-in-time restore within the retention period. Licence-included pricing bundles the SQL Server licence per vCPU-hour; Standard edition is much cheaper than Enterprise and is enough for most line-of-business apps.
dotnet lambda deploy-function --function-runtime dotnet10 and note the Init Duration in its CloudWatch log REPORT line.provided.al2023 and compare the init duration.AddAWSLambdaHosting, and compare cold and warm latency.The same Minimal API runs on Kestrel locally and in Lambda; a separate SQS-triggered function handles background work.
// Api/Program.cs: Minimal API that can run in Lambda behind an HTTP API, or anywhere with Kestrel.
using Microsoft.EntityFrameworkCore;
var builder = WebApplication.CreateBuilder(args);
// Only active when running inside Lambda; locally Kestrel serves requests as usual.
builder.Services.AddAWSLambdaHosting(LambdaEventSource.HttpApi);
builder.Services.AddDbContext<OrdersDb>(o => o.UseSqlServer(
builder.Configuration.GetConnectionString("Orders"),
sql => sql.EnableRetryOnFailure())); // RDS Multi-AZ failover switches DNS; retry transient errors
var app = builder.Build();
app.MapGet("/orders/{id:int}", async (int id, OrdersDb db, CancellationToken ct) =>
await db.Orders.AsNoTracking().FirstOrDefaultAsync(o => o.Id == id, ct) is { } order
? Results.Ok(order)
: Results.NotFound());
app.Run();
public sealed record Order(int Id, string Customer, decimal Total);
public sealed class OrdersDb(DbContextOptions<OrdersDb> options) : DbContext(options)
{
public DbSet<Order> Orders => Set<Order>();
}
// Worker/Function.cs: SQS-triggered Lambda with partial batch failure reporting.
using Amazon.Lambda.Core;
using Amazon.Lambda.SQSEvents;
[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))]
namespace Worker;
public sealed class Function
{
// Built once per execution environment (during INIT), reused while warm.
private static readonly HttpClient Http = new();
public async Task<SQSBatchResponse> Handler(SQSEvent evt, ILambdaContext context)
{
var failures = new List<SQSBatchResponse.BatchItemFailure>();
foreach (var message in evt.Records)
{
try
{
await ProcessAsync(message.Body);
}
catch (Exception ex)
{
context.Logger.LogError($"Message {message.MessageId} failed: {ex.Message}");
// Only this message returns to the queue; the rest of the batch is deleted.
failures.Add(new() { ItemIdentifier = message.MessageId });
}
}
return new SQSBatchResponse(failures);
}
private static Task ProcessAsync(string body) => Task.CompletedTask; // idempotent work goes here
}
# Deploy the worker on the managed .NET 10 runtime, on Arm (Graviton) for lower cost.
dotnet lambda deploy-function OrdersWorker \
--function-runtime dotnet10 \
--function-architecture arm64 \
--function-memory-size 1024 \
--function-role orders-worker-role
HttpClient inside the handler. Why it is wrong: Each invocation pays the creation cost and can exhaust sockets. Instead: Create them once in a static field or the constructor so they are reused while the environment is warm.ReportBatchItemFailures and return SQSBatchResponse with only the failed message ids.aspnet chiseled runtime image (or Native AOT) and keep the image in ECR in the same region.EnableRetryOnFailure and keep connection timeouts short.Throttles or ECS memory. Why it is wrong: Account concurrency limits and OOM-killed tasks fail silently from the user's view. Instead: Set CloudWatch alarms on Throttles, Errors, ConcurrentExecutions, ECS MemoryUtilization and ALB 5xx counts.The senior answer is a decision, not a catalogue: pick the least operationally heavy option that meets the workload's latency, duration and cost needs. Lambda wins on bursty, short work and loses on steady high load and strict p99. Fargate is the sensible default for a containerised .NET API. EKS is an organisational choice about owning a platform. RDS for SQL Server is a migration enabler; the long-term cost question is whether you stay on SQL Server at all.
Measure it: compare cost per million requests and p99 for both Lambda and Fargate at your real traffic profile, and read Init Duration in Lambda REPORT logs before arguing about cold starts.
| Option | When it fits | Cost profile | When not to |
|---|---|---|---|
| Lambda | Event-driven, spiky, short | Pay per use; zero when idle | Steady load, >15 min, strict p99 without AOT |
| ECS on Fargate | Steady APIs and workers | Per vCPU and GB-hour | Very bursty work idle most of the day |
| EKS | Platform team, many services | Control plane fee plus nodes plus people | Small teams |
| RDS for SQL Server | Existing SQL Server estate | Licence-included per vCPU-hour | Greenfield where PostgreSQL would do |
I choose by how much platform the team wants to run:
The trade-off is control versus operations: each step towards AKS gives more control and more work. I start with the simplest option that meets the requirements and move only when I hit a concrete limit.
Azure Functions runs small pieces of code in response to triggers (HTTP, Service Bus, Blob, Timer, Event Grid). For .NET 10 you use the isolated worker model: your code runs in its own process with a normal Program.cs, DI and middleware, and talks to the Functions host over gRPC. The in-process model reached end of support in November 2026.
The trade-off: very little infrastructure work and per-event scaling, in exchange for the platform's execution limits and an at-least-once programming model.
First I measure: the Init Duration in the CloudWatch REPORT lines (or Lambda Insights), and a trace of the INIT phase to see where time goes: runtime start, assembly loading, DI, SDK clients, secrets fetched at start-up, and VPC networking if the function is attached to a VPC. Then I try the cheapest fixes first:
System.Text.Json.Scheduled warm-up pings (an EventBridge rule every few minutes) keep only one environment warm, so they don't help when traffic scales out. If p99 still matters, I publish with Native AOT on provided.al2023, or pay for provisioned concurrency for the latency-critical function only. I re-measure after each change.
Last updated 23 Nov 2026.