Module 3: .NET Application Development on AWS
Build, containerise, configure and deploy ASP.NET Core applications on AWS the way a bank would run them. You compare every hosting option (EC2, Elastic Beanstalk, ECS on Fargate, Lambda and more) and finish by deploying the same Web API three different ways.
Assumes: .NET 10 LTS · AWS SDK for .NET v4 · Lambda dotnet10 · Region us-east-1. Verified against official sources on 2026-11-18.
Build, containerise, configure and deploy ASP.NET Core applications on AWS the way a bank would run them. You compare every hosting option (EC2, Elastic Beanstalk, ECS on Fargate, Lambda and more) and finish by deploying the same Web API three different ways.
| Estimated time | About 30 hours (lessons 18 h · labs 8 h · project 4 h) |
| Priority for you | ⭐ Critical — priority 1 (deploying .NET on AWS) |
| Level | Beginner → advanced |
| Certifications | DVA-C03 (primary) · SAA-C03 |
| Cost profile | 🟢 local + Lambda · 🟡 Fargate/Beanstalk deploy-and-destroy |
Why this matters in banking
Most of your bank's AWS workload will be .NET code you or your colleagues write. Choosing the wrong host costs money every hour (an idle load balancer), creates operational toil (patching Windows servers you didn't need) or causes outages (a container that is killed because its health check is wrong). Regulators and auditors will also ask how secrets are stored, how configuration changes are controlled and how every request can be traced. This module teaches the habits that answer those questions from day one.
From .NET/Azure to AWS
| You know (Microsoft/Azure) | AWS equivalent | What's different |
|---|---|---|
| IIS on a Windows VM | EC2 (Windows or Linux) behind an ALB | You own patching, scaling and AMIs; Linux + Kestrel is cheaper |
| Azure App Service | Elastic Beanstalk, or ECS Express Mode | Beanstalk creates real EC2/ALB resources you can see and pay for |
| Azure Container Apps / AKS | ECS on Fargate / EKS | ECS is AWS-native and simpler; EKS is managed Kubernetes |
| Azure Functions | AWS Lambda (dotnet10 runtime) | One handler per function, or host a whole ASP.NET Core app inside Lambda |
| Azure Container Registry | Amazon ECR | Built-in vulnerability scanning and lifecycle policies |
| Managed identity | IAM roles for EC2 instances, ECS tasks and Lambda functions | The SDK picks up temporary credentials automatically — no keys in config |
| App Configuration / Key Vault | SSM Parameter Store, AWS AppConfig, Secrets Manager | Configuration, feature flags and secrets are three separate services |
| Application Insights logging | CloudWatch Logs (+ X-Ray / OpenTelemetry) | You ship structured JSON logs; queries use Logs Insights |
| WebJobs / Windows Services | Worker Service on Fargate, Lambda, EventBridge Scheduler | Schedules live outside the app as managed rules |
| Porting tools / Upgrade Assistant | AWS Transform for .NET + .NET Upgrade Assistant | AWS Transform is agentic and replaced Porting Assistant (see notes below) |
Learning objectives
By the end of this module you can:
- Register AWS SDK v4 clients through dependency injection with sensible retries, timeouts and Region settings, and explain the credential provider chain.
- Choose a hosting option for a given .NET workload and defend the choice on cost, operations, scaling and cold starts.
- Write a secure multi-stage Dockerfile (small base image, non-root user) and push it to ECR with scanning on.
- Layer configuration from
appsettings.json→ environment variables → Parameter Store/AppConfig, and read secrets from Secrets Manager with caching. - Add liveness/readiness health checks that ALB, ECS and Lambda-fronting services can use correctly.
- Emit structured JSON logs with correlation IDs and return ProblemDetails errors from a global exception handler.
- Protect an API with Cognito-issued JWTs and policy-based authorisation, and give the running code least-privilege IAM permissions.
- Run background work as hosted services, SQS consumers or scheduled jobs.
Prerequisites
- Module 0: Orientation — CLI SSO profile, budgets and Docker installed
- Module 1: AWS fundamentals — IAM roles, credential chain, Regions
- Module 2: Networking — VPC, subnets, security groups and load balancers
- Recommended: the identity and data-protection lessons of Module 5
How the pieces fit
The default answer for a new banking API is ECS on Fargate behind an ALB in private subnets. Lambda wins for event-driven and spiky work; EC2 and Beanstalk remain for legacy and lift-and-shift.
Lessons
- AWS SDK for .NET v4 in depth — clients, credential provider chain, profiles, Region config, retries, timeouts, pagination and async patterns.
- AWS clients and dependency injection —
AWSSDK.Extensions.NETCore.Setup, client lifetimes, per-environment options and testing with fakes. - Lab 3.1: an SDK v4 console app — the hands-on checkpoint for lessons 1 and 2.
- ASP.NET Core Web API on AWS: the baseline — Kestrel behind a load balancer, forwarded headers, HTTPS termination and the bank's reference API.
- Hosting options compared — EC2 (Linux and Windows), Elastic Beanstalk, ECS on Fargate, ECS on EC2, EKS overview, Lambda, ECS Express Mode, and why App Runner is no longer an option for new accounts.
- Containerising .NET — multi-stage builds, chiseled images, non-root user, image size and startup time.
- Amazon ECR — private repositories, scan on push, immutable tags and lifecycle policies.
- Deploying to ECS on Fargate — task definitions, services, task roles vs execution roles, ALB target groups and private subnets.
- Elastic Beanstalk for .NET — the .NET 10 on Amazon Linux 2023 platform, the Windows/IIS platform, and what Beanstalk creates for you.
- Lambda with C# — handlers, the Lambda Annotations framework, ASP.NET Core on Lambda, Native AOT, cold starts and SnapStart.
- Configuration done right — appsettings, environment variables, Parameter Store and AppConfig, plus feature flags with safe rollout.
- Secrets — Secrets Manager with client-side caching, rotation and how to avoid secrets in environment variables.
- Health checks — liveness vs readiness, ALB and ECS health checks, grace periods and the restart-loop trap.
- Lab 3.2: containerise the Accounts API — a chiseled, non-root image run locally with docker compose.
- Lab 3.3: ECR and Fargate — push with scan on push, deploy behind an ALB in private subnets, then destroy.
- Scaling .NET apps — target tracking, statelessness, connection-pool sizing, session state in ElastiCache or DynamoDB.
- Logging and errors —
ILogger/Serilog to CloudWatch, structured JSON, correlation IDs, ProblemDetails and global exception handling. - Authentication and authorisation — Cognito user pools, JWT bearer validation, policy-based authorisation and IAM roles for tasks.
- Background processing — Worker Services, hosted services, SQS consumers and EventBridge Scheduler jobs.
- Porting .NET Framework apps — AWS Transform for .NET, the .NET Upgrade Assistant and when to rehost on Windows instead.
Labs and module project
The code for the labs and the project is one shared repository folder: labs/m03-accounts-api/ (the Harbourline Accounts API, its tests, a Dockerfile, a compose file and CDK stacks for all three hosts). Its README.md explains how to run it.
- Lab 3.1 (🟢) — Console app that lists S3 buckets and calls STS
GetCallerIdentityusing an SSO profile and DI-registered clients. - Lab 3.2 (🟢) — Containerise the reference API with a chiseled, non-root image and run it locally with docker compose.
- Lab 3.3 (🟡) — Push to ECR with scan on push, deploy to Fargate in private subnets behind an ALB, then destroy.
- Lab 3.4 (🟢) — The same API on Lambda with the
dotnet10runtime and an HTTP API (CDK or Terraform); replay an API Gateway event, read cold starts from theREPORTlines, and compare memory sizes, ReadyToRun and SnapStart. Native AOT is covered as a design discussion in Lambda with C#, because this API's reflection-based dependencies are not AOT-ready. - Lab 3.5 (🟡) — Parameter Store and Secrets Manager configuration with caching and a rotated secret: change a feature flag without a restart, read a key through the client-side cache, rotate it, and decide what that does to log correlation.
Module project (🟡): one API, three hosts. Deploy the Accounts API (fictional data) to Elastic Beanstalk, ECS on Fargate and Lambda + API Gateway. Measure each with the same latency probe, price each with a stated cost model, write a one-page comparison of cost, p95 latency, cold start, deployment effort and operational burden, and record your recommendation as an architecture decision record (ADR). The code, CDK stacks, a Terraform variant for the Lambda host, and the probe are in labs/m03-accounts-api/.
When you finish, keep the Module 3 cheat sheet handy for revision.
Cost profile
| Part | Label | Free alternative |
|---|---|---|
| SDK, DI, Docker, configuration, logging labs | 🟢 free | Run locally; use AWS Emulator or SAM local for S3/SQS/Lambda calls |
| Lambda + HTTP API deployment | 🟢 free | Within the Lambda always-free allowance for lab traffic |
| ECS on Fargate + ALB | 🟡 credits | Deploy, test and destroy within an hour; ALB and Fargate bill per hour |
| Elastic Beanstalk | 🟡 credits | Use a single-instance environment (no load balancer) and terminate it the same day |
| Secrets Manager | 🟡 credits | Parameter Store SecureString for labs (free standard parameters); learn rotation design-only |
| EKS | 🔴 paid | Design-only exercise; the control plane bills hourly. Use ECS instead for hands-on |
Certification alignment
| Exam | Domains (weight) | What this module covers |
|---|---|---|
| DVA-C03 | Development (30%) · Security (26%) · Test & Deploy (22%) · Troubleshoot (22%) | SDK use, Lambda, containers, secrets, deployment, logging |
| SAA-C03 | High-Performing (24%) · Cost-Optimized (20%) | Choosing compute, scaling and cost trade-offs |
The domain labels are short forms; see each exam page for the official wording.
Service availability notes
Services that changed — verified 2026-11-17
AWS App Runner is in maintenance and closed to new customers (announced 2026-03-31). AWS recommends Amazon ECS Express Mode instead, which provisions Fargate, an ALB and auto scaling from a container image at no extra charge beyond the resources it creates.
Porting Assistant for .NET, App2Container, the AWS Toolkit for .NET Refactoring and Microservice Extractor closed to new customers on 2025-11-07. AWS Transform for .NET (GA May 2025) is the recommended replacement.
Elastic Beanstalk is active and offers a .NET 10 platform branch on Amazon Linux 2023.
Lambda SnapStart supports .NET managed runtimes from .NET 8; confirm dotnet10 support and current Region coverage before the lab ⚠ VERIFY.
Key AWS services
AWS SDK for .NET v4 · Amazon EC2 · AWS Elastic Beanstalk · Amazon ECS (Fargate, EC2, Express Mode) · Amazon EKS (overview) · AWS Lambda · Amazon API Gateway · Elastic Load Balancing (ALB) · Amazon ECR · AWS Systems Manager Parameter Store · AWS AppConfig · AWS Secrets Manager · Amazon Cognito · Amazon CloudWatch Logs · AWS X-Ray · Amazon EventBridge Scheduler · Amazon SQS · Amazon ElastiCache · AWS Transform for .NET
Independent learning resource — not affiliated with, endorsed or sponsored by Amazon Web Services. AWS and related marks are trademarks of Amazon.com, Inc. or its affiliates. All banking data in examples is fictional. Sample architectures are for learning and are not automatically compliant with GDPR, PCI DSS or any banking regulation.
Module 2 cheat sheet
One-page revision summary for AWS Networking: services, Azure mapping, CLI commands, limits, decision rules, exam traps and cost traps.
AWS SDK for .NET v4 in depth
Use the AWS SDK for .NET v4 the way production code should: explicit Regions, the credential provider chain, SSO profiles for local work, retries and deadlines, paginators, error handling and the v4 breaking changes that bite during upgrades.