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.
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
2026
2024
2026
2026
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.