Designing Highly Available and Fault-Tolerant Architectures on AWS: Multi-AZ, Loose Coupling and Failure Patterns
Availability vs Fault Tolerance
| Term | Meaning | Example |
|---|---|---|
| High availability (HA) | The system recovers quickly and is up most of the time. Short interruption can happen | Multi-AZ RDS: ~1 to 2 minutes to fail over |
| Fault tolerance | The system keeps working with no interruption when a component fails. Needs more redundancy and cost | Active-active across AZs with spare capacity; S3 (data across 3 AZs) |
| Resilience | The ability to withstand and recover from failures, including slow ones and overload | Retries, back-pressure, auto healing |
| Durability | Data is not lost over time | S3: 11 nines |
Find and Remove Single Points of Failure
Walk through your design and ask for each box: "If this fails, what happens?" Fix every box that stops the system.
| Component | Weak design | Resilient design |
|---|---|---|
| Web servers | One EC2 instance | ASG across 2+ AZs behind an ALB |
| Database | Single-AZ RDS | Multi-AZ RDS or Aurora with replicas in other AZs |
| NAT | One NAT Gateway for all AZs | One NAT per AZ (or endpoints) |
| Storage | Data on instance store or one EBS | S3, EFS (multi-AZ) or EBS with snapshots and replication |
| Sessions | In memory of one server | ElastiCache or DynamoDB |
| DNS | A hosted name on one server | Route 53 (100 percent SLA design) |
| Load balancer | A single custom proxy | ALB/NLB (multi-AZ managed) |
| Messaging | Direct HTTP calls | SQS/SNS between tiers |
| Region | Everything in one Region (if needed) | Multi-Region per DR needs |
| Human steps | Manual recovery | Automation: auto scaling, auto recovery, IaC |
Reference: Multi-AZ Web Architecture
text
Route 53 (health checks) ─► CloudFront + WAF
│
ALB (public subnets: AZ-a, AZ-b, AZ-c)
┌───────────┬───────────┐
ASG web tier: instances in private subnets of each AZ (min 3 for 3 AZs)
│ stateless; sessions in ElastiCache; files in S3
Aurora cluster: writer in AZ-a, readers in AZ-b and AZ-c (failover priority set)
NAT Gateway per AZ, VPC endpoints for S3/DynamoDB
- N+1 or N+2 capacity: if you need 2 instances' worth of capacity and use 2 AZs, run at least 4 (2 per AZ) so losing an AZ still leaves enough. With 3 AZs, 3 instances means 2 left after an AZ failure (66 percent)
- Spread evenly: ASG AZ rebalancing keeps balance
- Check service quotas in the other AZ/Region so scale-out works during failure
- Use Auto Scaling health checks from the ELB so unhealthy instances are replaced automatically
Design Principles for Resilience
| Principle | How to apply |
|---|---|
| Design for failure | Assume every component will fail. Test it |
| Stateless components | Any instance can serve any request. Store state in shared services |
| Loose coupling | Queues, events and APIs between tiers. SQS absorbs spikes |
| Health checks and self-healing | ELB checks, ASG replacement, ECS service scheduler, EC2 auto recovery |
| Redundancy across AZs | At least two AZs for everything important |
| Automate recovery | Runbooks as code, Systems Manager Automation, Lambda reacting to alarms |
| Immutable infrastructure | Replace instead of patching by hand: new AMI, rolling update |
| Limit blast radius | Cells/shards, separate accounts, per-customer isolation |
| Test | Game days, AWS Fault Injection Service (FIS), restore tests |
Client-Side Resilience Patterns
| Pattern | What it does |
|---|---|
| Retry with exponential backoff and jitter | Retry failed calls with growing, randomized waits so retries do not create a storm. AWS SDKs do this by default |
| Timeouts | Never wait forever. Set short timeouts on every remote call |
| Circuit breaker | After many failures stop calling the broken dependency for a while and fail fast |
| Bulkhead | Separate thread pools or queues so one slow dependency does not use all capacity |
| Idempotency | Safe to repeat requests: use idempotency keys |
| Graceful degradation | Show cached or reduced content instead of an error (for example hide recommendations if that service is down) |
| Load shedding / throttling | Reject excess requests early (429/503) to protect the core |
python
import random, time
def call_with_backoff(fn, max_attempts=5, base=0.2, cap=5.0):
for attempt in range(1, max_attempts + 1):
try:
return fn()
except TransientError:
if attempt == max_attempts:
raise
sleep = random.uniform(0, min(cap, base * 2 ** attempt)) # full jitter
time.sleep(sleep)
Database and Storage Resilience
| Service | Built-in resilience | What you add |
|---|---|---|
| S3 | Data in 3+ AZs, 11 nines | Versioning, replication to another Region, Object Lock |
| EBS | Replicated within one AZ | Snapshots, Multi-AZ via application replication, AWS Backup |
| EFS | Multi-AZ (Standard) | Backups, replication |
| RDS | Optional Multi-AZ | Turn it on, read replicas, backups, PITR, cross-Region replica |
| Aurora | 6 copies in 3 AZs, fast failover | Replicas in other AZs, Global Database |
| DynamoDB | Data in 3 AZs | PITR, global tables |
| ElastiCache Redis | Optional replicas | Multi-AZ with automatic failover |
Availability Math
text
Components in SERIES multiply: 99.9% x 99.9% = 99.8% (more parts = less availability)
Components in PARALLEL improve: 1 - (0.001 x 0.001) = 99.9999% (two independent copies)
So: remove serial dependencies and add independent redundancy.
Practical meaning A chain of five services each at 99.9 percent gives about 99.5 percent overall. Redundancy at each layer and decoupling brings it back up.
Chaos Engineering With FIS
- AWS Fault Injection Service runs controlled experiments: stop instances, add latency, throttle API calls, fail over an RDS cluster, disrupt network between AZs
- Start with a hypothesis (the site stays up if one AZ fails), define stop conditions (CloudWatch alarm), run in staging, then carefully in production
- Fix what you learn and repeat
json
{
"description": "Stop 50 percent of web instances",
"targets": {"webInstances": {"resourceType": "aws:ec2:instance", "resourceTags": {"Role": "web"}, "selectionMode": "PERCENT(50)"}},
"actions": {"stop": {"actionId": "aws:ec2:stop-instances", "parameters": {"startInstancesAfterDuration": "PT10M"}, "targets": {"Instances": "webInstances"}}},
"stopConditions": [{"source": "aws:cloudwatch:alarm", "value": "arn:aws:cloudwatch:ap-south-1:123456789012:alarm:HighErrorRate"}],
"roleArn": "arn:aws:iam::123456789012:role/fis-role"
}
Failure Analysis Checklist
- What if one instance fails? One AZ? One Region?
- What if a dependency is slow, not just down?
- What if traffic doubles in 5 minutes?
- What if bad data or a bad deployment is released? (rollback, canary)
- What if a human deletes something? (backups, MFA delete, SCPs, IAM)
- What is the recovery time and data loss for each case (RTO and RPO)?
Practice Tasks
- Take a single-instance web app diagram and mark every single point of failure with a fix
- Calculate the minimum instances per AZ to survive losing one of three AZs with 100 percent capacity
- Terminate an instance in an ASG and one RDS primary (failover) and measure the downtime
- Implement retries with exponential backoff and jitter in a sample client
- Design an experiment to prove the app survives an AZ failure
Conclusion
Avoid single points of failure with multi-AZ at every tier, stateless instances, ELB health checks, auto scaling and managed multi-AZ data services. Add client-side patterns (timeouts, retries with jitter, circuit breakers, graceful degradation), automate recovery and prove it with failure testing.
Quick Summary: HA vs FT; SPOF table; multi-AZ diagram + N+1; principles; client patterns + backoff code; data resilience table; availability math; FIS; failure checklist.

