Sub topic 16
Weighing Cost and Complexity Against Availability Goals
This chapter assumes you have read the earlier chapters on NAT gateways, load balancing, Auto Scaling, RDS Multi-AZ, and static stability. It also assumes you know basic AWS billing: hourly resource charges, per-GB data processing, and per-GB data transfer. Prices change and differ by Region, so this chapter shows the structure of each cost and not dollar figures. Check the AWS pricing pages for current numbers.
Why availability is a purchase decision
Every step toward higher availability adds resources, data transfer, or operational work. A design that survives one AZ failure costs more than a single-AZ design. A design that survives a Region failure costs more again. The goal is not the highest availability. The goal is the availability the business needs, at a cost it accepts.
Start from the targets you set in the first chapter: the availability SLO, the RTO, and the RPO. Then ask what an hour of downtime costs. Lost revenue, support load, contract penalties, and reputation all count. If an hour of downtime costs a few hundred dollars, a design that adds thousands of dollars a month is hard to justify. If it costs tens of thousands, the same spend is cheap insurance.
Where multi-AZ costs come from
The extra cost of a multi-AZ design falls into five groups.
| Cost area | What adds cost | How it scales |
|---|---|---|
| Compute headroom | Spare instances so the remaining AZs can absorb the load of a lost AZ | With the number of AZs and your peak load |
| NAT gateways | One zonal NAT gateway per AZ, each with an hourly charge | With the number of AZs |
| Database standby | A synchronous standby (RDS Multi-AZ) or extra Aurora replicas | Roughly doubles the instance cost for RDS Multi-AZ |
| Cross-AZ data transfer | Per-GB charges for traffic between AZs | With traffic volume |
| Operations | More templates, more tests, more alarms, more runbooks | With team size and system count |
Compute headroom
Static stability means you do not launch capacity during a failure. You run enough instances beforehand that losing one AZ still leaves you able to serve peak traffic. The amount of idle capacity depends on how many AZs you use.
With N AZs, each AZ must be able to carry its share, and the surviving N-1 AZs must carry everything. Each surviving AZ therefore needs to handle load / (N-1). Normal utilization of each instance should stay below (N-1)/N of its safe maximum.
| AZs | Surviving AZs after one loss | Max normal utilization of safe capacity | Idle capacity in normal operation |
|---|---|---|---|
| 2 | 1 | 50% | 50% |
| 3 | 2 | 67% | 33% |
| 4 | 3 | 75% | 25% |
Three AZs often cost less in compute than two for the same resilience, because the headroom fraction is smaller. The trade-off is that each extra AZ adds its own NAT gateway, subnets, and endpoints.
NAT gateways and cross-AZ transfer
A NAT gateway has an hourly charge plus a per-GB data processing charge. One NAT gateway per AZ costs more than a shared one, but a shared one is a single point of failure and sends traffic across AZs, which adds data transfer charges. Compare the options:
- One NAT gateway in one AZ: lowest hourly cost, but an AZ failure removes egress for every AZ, and the other AZs pay cross-AZ transfer to reach it.
- One NAT gateway per AZ: highest hourly cost, no cross-AZ hop, and each AZ keeps its own egress.
For heavy traffic to AWS services, gateway endpoints for S3 and DynamoDB carry no hourly or data processing charge, and they remove that traffic from the NAT gateway. Interface endpoints have their own hourly and per-GB charges, so they pay off only when NAT processing charges would be higher.
Cross-AZ traffic also comes from load balancers and databases. Cross-zone load balancing on an Application Load Balancer has no extra charge for the cross-zone traffic. On a Network Load Balancer, enabling it incurs cross-AZ data transfer charges. Replication to a Multi-AZ standby is included in the RDS price, but your application reading from a database in another AZ pays transfer for that traffic.
Use this command from the earlier chapter to turn on cross-zone balancing for a target group, and weigh it against the transfer it can add:
aws elbv2 modify-target-group-attributes \
--target-group-arn "$TARGET_GROUP_ARN" \
--attributes Key=load_balancing.cross_zone.enabled,Value=trueDo not remove cross-AZ traffic at the expense of resilience. Zone-aware routing that keeps requests inside one AZ reduces cost and latency, but you must still allow traffic to leave the AZ when local targets fail.
Complexity is a cost too
Each added component creates a new failure mode. A multi-AZ design has more moving parts: health checks that can misfire, failover logic that must be tested, and configuration that must be identical across AZs.
Complexity costs appear as:
- Longer onboarding and more code to review.
- Failover paths that run rarely, so they hide bugs until a real incident.
- Configuration drift between AZs, such as a route table that differs in one subnet.
- Alarm noise from per-AZ metrics that no one has tuned.
Prefer managed features over custom ones when they meet the target. RDS Multi-AZ failover is a single flag. A script that promotes a replica and updates DNS is more flexible but is your code to test and maintain.
aws rds modify-db-instance \
--db-instance-identifier mydb \
--multi-az \
--apply-immediatelyMatching design to target
Use the table as a starting point, not a rule. The right tier depends on your measured cost of downtime.
| Tier | Typical design | Survives | Relative cost |
|---|---|---|---|
| Development and test | Single AZ, no standby | Instance failure only if you rebuild | Lowest |
| Internal tools | Two AZs, ASG with minimum 2, RDS Multi-AZ | One AZ loss with a brief interruption | Moderate |
| Customer-facing | Three AZs, headroom for one AZ loss, per-AZ NAT, tested failover | One AZ loss with little or no impact | Higher |
| Business-critical | Customer-facing design plus a multi-Region standby or active-active setup | Region loss | Highest |
Multi-AZ does not protect against a bad deployment, a deleted database, a bug that corrupts data, or a Region-wide event. Backups, deployment safety, and the multi-Region boundary from the previous chapter cover those cases, and each carries its own cost.
Ways to reduce cost without losing resilience
- Right-size after measuring. Review CPU and request metrics per AZ, then adjust instance size and the headroom percentage. Over-provisioning "to be safe" often exceeds what the failure case needs.
- Use commitments for the baseline. Savings Plans or Reserved Instances apply to the steady capacity you always run, including the headroom. Leave burst capacity on demand.
- Use Spot carefully. Spot suits fault-tolerant, stateless work. Do not count on Spot for the headroom that must exist during an AZ failure, because Spot capacity can be reclaimed, and it may be scarce in the surviving AZs exactly when you need it.
- Keep non-production smaller. Run staging with a single AZ or a smaller footprint, but run your failover tests in an environment that matches production topology.
- Add endpoints where traffic justifies them. Move S3 and DynamoDB traffic off NAT with gateway endpoints.
- Reduce cross-AZ chatter. Keep chatty tiers in the same AZ when possible, and use zone-aware routing with fallback.
Making the decision
A practical process:
- Write down the SLO, RTO, and RPO, and the estimated cost of one hour of downtime.
- List the single points of failure in the design and which ones the targets require you to remove.
- Price each remedy using the five cost areas above.
- Pick the cheapest design that meets the targets, and record what it does not cover.
- Revisit the decision when traffic, revenue, or the architecture changes.
Common mistakes
- Paying for a Multi-AZ database but running the application in one AZ, so the application is still the single point of failure.
- Setting the Auto Scaling minimum to the number of AZs and calling it headroom, even though the remaining instances cannot carry peak load.
- Removing per-AZ NAT gateways to save money without noting that an AZ failure now breaks egress everywhere.
- Never running the failover test, so the extra spend buys an untested assumption.
Exercise
A stateless web tier peaks at 12 instances' worth of load. You run in three AZs and must survive the loss of one AZ at peak without launching new instances. How many instances do you need in total, and how many per AZ? What would the total be with two AZs?
Show answer
With three AZs, the two surviving AZs must carry 12 instances' worth of load, so each needs 6. Running 6 per AZ gives 18 instances in total, which is 33% idle capacity in normal operation. With two AZs, the one surviving AZ must carry all 12, so each AZ needs 12 and the total is 24, which is 50% idle. Three AZs need 6 fewer instances, though each extra AZ adds its own NAT gateway and subnet costs.
Exercise
Your team proposes replacing three per-AZ NAT gateways with one to save the hourly charges. Name two consequences besides the saving.
Show answer
First, the NAT gateway's AZ becomes a single point of failure for egress, so losing that AZ cuts outbound access for instances in every AZ. Second, instances in the other two AZs send egress traffic across AZ boundaries, which adds cross-AZ data transfer charges and latency, and these may offset part of the saving.