Home icon

Deploy Blazor Server applications on Amazon ECS with AWS Fargate

.NET on AWS Blog



This article provides a comprehensive guide to deploying Blazor Server applications on Amazon ECS with AWS Fargate, addressing the unique infrastructure requirements of stateful Blazor Server circuits.

  • Blazor Server maintains persistent WebSocket connections and in-memory circuits requiring sticky session routing to a single container instance
  • Configure target group cookie stickiness to bind browsers to specific Fargate tasks using awsvpc networking
  • Align timeout settings across CloudFront (60s OriginReadTimeout), load balancer (60s idle), and SignalR (15s keep-alive) to maintain WebSocket connections
  • Use CloudFront VPC origin to expose internal Application Load Balancer as the only public endpoint
  • Set deregistration delay to 60 seconds and ShutdownTimeout below StopTimeout to gracefully drain in-flight requests during deployments
  • Store session state in external services like RDS PostgreSQL or ElastiCache Redis to survive task replacement
  • Configure Data Protection with AWS Systems Manager Parameter Store for shared encryption keys across multiple instances
  • Complete AWS CDK stack provided in C# for VPC, ECS cluster, Fargate service, ALB, and CloudFront distribution

Proper infrastructure configuration enables Blazor Server deployments on Fargate while maintaining session continuity and graceful handling of task lifecycle events.



Go to article

The AWS News Feed is currently looking for gold sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.

Related articles

Jul 9
2026
Host a .NET Blazor WebAssembly App on Amazon S3 and Amazon CloudFront
Feb 12
2024
Using Amazon ECS with AWS Fargate to automate Azure DevOps Hosted Agents
Oct 20
2026
Introducing Amazon ECS Gateway: A fully-managed ingress solution for ECS services
Oct 21
2026
Announcing Amazon ECS Gateway, a managed ingress solution for your ECS services

The AWS News Feed is currently looking for silver sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.