Multi-region disaster recovery for Amazon API Gateway WebSocket APIs
Architecture Blog
This article presents a multi-region disaster recovery pattern for Amazon API Gateway WebSocket APIs that automatically reconnects clients and restores state during regional failover.
- Active-passive architecture with primary and secondary regions sharing state via DynamoDB Global Tables
- Route 53 failover routing detects regional failures and redirects traffic automatically
- Canary health probe opens WebSocket connections every minute to detect failures independently
- CloudWatch alarms trigger Route 53 health check updates after two consecutive probe failures
- Client-side exponential backoff with jitter prevents thundering herd during reconnection
- Clients restore application state by sending getState message after reconnecting to secondary region
- Heartbeat mechanism (30-second interval, 35-second timeout) monitors connection health
- Demo auction application shows real-time state synchronization across regions during failover
This pattern enables seamless failover for real-time applications like trading platforms, collaborative editors, and gaming leaderboards by separating application state from WebSocket connections.
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
2024
2025
2026
2025
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.