Sub topic 3
Finding failure domains and single points of failure
This chapter assumes you know what a Region and an Availability Zone (AZ) are, can read a VPC layout, and can run AWS CLI commands. The previous chapters covered SLAs, RTO, RPO, and AZ identity. Here you learn to look at an architecture and find what can take it down.
What a failure domain is
A failure domain is the set of things that fail together because they share a cause. A power feed, a rack, a software release, or an IAM policy can each define one. When you design for availability, you ask which failure domains your workload sits in and whether any single one can stop it.
A single point of failure (SPOF) is a component that, if it fails, stops the whole workload, with no alternative path. A SPOF is relative to a failure domain. Two web servers in one AZ are not a SPOF at the instance level, because either can serve traffic. At the AZ level they are one, because both disappear together.
Failure domains on AWS
AWS nests its failure domains. Each level contains the one before it.
| Failure domain | Typical cause | What you do about it |
|---|---|---|
| Process or container | Crash, memory leak | Restart, run several copies |
| Instance or host | Hardware fault, kernel panic | Replace automatically, run several instances |
| Availability Zone | Power, cooling, or network event in a data center group | Run in at least two AZs |
| Region | Regional service event, large natural disaster | Multi-Region design (covered later in this tutorial) |
| Account or credentials | Deleted resources, compromised keys, quota exhaustion | Account separation, least privilege, backups in another account |
| Change or deployment | Bad release, bad configuration | Staged rollouts, rollback, feature flags |
The last two rows matter because they ignore physical boundaries. A faulty deployment reaches every AZ at once. Multi-AZ design protects you from infrastructure faults. It does not protect you from your own changes.
An AZ is one or more discrete data centers with independent power, cooling, and networking, and AZs in a Region are connected by low-latency links. Treat an AZ as the unit that can disappear. Most of this tutorial is about surviving that loss.
Zonal, regional, and global resources
Every AWS resource has a scope. The scope tells you which failure domain it lives in, so you can spot a SPOF by checking it.
- Zonal resources live in one AZ. Examples are EC2 instances, EBS volumes, subnets, and NAT gateways. If the AZ fails, they fail.
- Regional resources are spread across AZs by AWS. Examples are S3, DynamoDB, an Application Load Balancer, and an Internet Gateway. You do not choose their AZ placement, though you may choose which AZs an ALB uses.
- Global resources have a control plane in one place and a data plane that is distributed. Examples are IAM and Route 53.
The load balancer and the two web instances look redundant. But if AZ a fails, the database and NAT gateway go with it. The web instance in AZ b is healthy but cannot serve a useful response, so the whole workload is down.
A method for finding SPOFs
Work through the architecture in a fixed order. Doing it the same way each time keeps you from skipping the boring components.
- Draw the request path. Start at the user and follow one request to every dependency it touches: DNS, load balancer, compute, cache, database, queues, and external APIs. Do the same for the write path and for background jobs.
- Label each component with its scope. Mark each as zonal, regional, or global, and note which AZ it sits in.
- Count the copies per failure domain. For each component, ask how many independent copies exist and in how many AZs. One copy, or several copies in one AZ, is a SPOF at the AZ level.
- Remove one domain in your head. Delete AZ a from the diagram. Does a complete path from user to data remain? Repeat for each AZ.
- Check the hidden dependencies. These are covered in the next section.
- Rank by blast radius. Fix what stops the whole workload first, then what degrades one feature.
Hidden SPOFs
Obvious SPOFs, like a single database, are easy to find. These are the ones that often survive reviews.
- Egress through one NAT gateway. Instances in every AZ route through a NAT gateway in a single AZ. Losing that AZ cuts outbound traffic from the healthy AZs. The next chapters cover the fix.
- Subnets used by only one tier. The web tier spans two AZs, but the app tier has subnets in one. Each tier needs subnets in at least two AZs.
- A single-AZ database. An RDS instance without Multi-AZ is one instance in one AZ.
- EBS volumes and instance store. An EBS volume lives in one AZ. Data on it is lost to you if that AZ is unavailable, unless you have snapshots or replicas elsewhere.
- Self-managed single nodes. A lone Jenkins server, a single Redis node, a NAT instance, or a bastion host.
- Stateful sessions. If sessions live in instance memory, losing an instance logs users out, and losing an AZ loses a share of all sessions.
- Hard-coded addresses. A configuration that points at one private IP or one AZ-specific endpoint, rather than a DNS name that fails over.
- Shared configuration and secrets. A single parameter, secret, or AMI that every instance needs at launch. If it is unavailable or deleted, replacements cannot start.
- Capacity and quotas. If two AZs each run at 70 percent load, losing one pushes the other to 140 percent. The architecture is redundant on paper and overloaded in practice. Quotas, such as the maximum number of running instances, can also block recovery.
- Control-plane dependence. A recovery plan that says "launch new instances in AZ b" requires API calls to work during the failure. Chapter 12 covers static stability, which avoids this.
- Operational access. If the only way to reach production is a bastion in one AZ, you cannot fix anything during the event.
Inspecting an account with the CLI
You can find several of these from the command line. These commands are read-only.
# Running instances per AZ: a lopsided count signals poor spread
aws ec2 describe-instances \
--filters Name=instance-state-name,Values=running \
--query 'Reservations[].Instances[].Placement.AvailabilityZone' \
--output text | tr '\t' '\n' | sort | uniq -c
# NAT gateways and the subnets they sit in: one per VPC suggests a shared egress SPOF
aws ec2 describe-nat-gateways \
--filter Name=state,Values=available \
--query 'NatGateways[].[NatGatewayId,VpcId,SubnetId]' \
--output table
# RDS instances without Multi-AZ, with the AZ each one lives in
aws rds describe-db-instances \
--query 'DBInstances[?MultiAZ==`false`].[DBInstanceIdentifier,AvailabilityZone,Engine]' \
--output tableRun these in each Region you use, adding --region if needed. Some results need interpretation:
- For the NAT gateway output, look up the AZ of each
SubnetIdwithaws ec2 describe-subnets. Then compare it with the AZs of the subnets whose route tables point at that gateway. - Aurora reports
MultiAZas false for individual instances, even when the cluster has readers in other AZs. Check Aurora at the cluster level by counting instances and their AZs. - Instance counts show where capacity is. They do not show whether each AZ could absorb the others' load.
Dependencies are failure domains too
Your availability is bounded by the services you depend on. If your workload needs a third-party payment API that has 99.9 percent availability, your workload cannot reliably exceed that for requests needing it, however many AZs you use. When tracing the request path, mark each external dependency and decide how to handle its failure. Options include timeouts, retries with backoff, a queue to absorb requests, or degrading the feature.
Similarly, serial dependencies multiply. If a request needs three components in series with 99.9 percent availability each, the combined availability is about 99.7 percent (0.999 × 0.999 × 0.999). Redundant components in parallel improve availability, and each serial hard dependency lowers it. Reducing the number of hard dependencies on the critical path is often cheaper than adding more redundancy.
Recording the result
Write the findings in a short table that can be reviewed and updated. It also gives you a work list for the rest of this tutorial.
| Component | Scope | AZs today | Failure of one AZ | Action |
|---|---|---|---|---|
| Application Load Balancer | Regional | a, b | Traffic shifts to b | None |
| Web instances | Zonal | a, b | Half of capacity lost | Add headroom |
| NAT gateway | Zonal | a | Egress lost for all | One per AZ |
| RDS instance | Zonal | a | Database lost | Enable Multi-AZ |
Review this table when the architecture changes, not only at design time. SPOFs return when someone adds a "temporary" single instance.
Exercise
A workload has an ALB across AZs a and b, an Auto Scaling group with 4 instances split evenly across a and b, one NAT gateway in AZ a that both AZs use for outbound traffic, and an RDS instance with Multi-AZ enabled. The app calls an external API through the NAT gateway on every request. List the single points of failure for the loss of AZ a, and say what happens to the instances in AZ b.
Show answer
The NAT gateway is the SPOF. It is zonal and lives in AZ a, so when AZ a fails, the instances in AZ b lose outbound access. Because every request calls the external API, those instances stay healthy at the OS level but cannot complete requests, and the workload is effectively down. The ALB is regional and the RDS Multi-AZ standby takes over, so they are not SPOFs, though the database endpoint briefly fails over. A second capacity issue also exists. The 2 instances left in AZ b must carry all the load, so check that they can handle 100 percent of traffic. The fix is a NAT gateway in each AZ, with each AZ's private route table pointing at its own gateway, and extra instance headroom.