
Detecting Single-AZ Impairment Before Your Customers Do
How to turn a gray failure in one Availability Zone into a signal you can act on, and then into an automated recovery, using CloudWatch composite alarms and Amazon Application Recovery Controller zonal shift.
Series: Operating at Hyperscale (10 articles)
- …
- 8Detecting Single-AZ Impairment Before Your Customers Do This article
The failure that doesn't trip your alarms
The outages that hurt a multi-tenant platform most are rarely the clean ones. A whole Region going dark is obvious and rare. The common, insidious case is a single Availability Zone degrading: elevated errors or latency in one AZ while the other two look fine. Your Regional dashboards average it away. Availability reads 99.3% because two zones at 100% are hiding one at 98%. Nobody pages. Meanwhile the tenants whose requests happen to land in the impaired zone are seeing failures, and they are telling their own users something is wrong before you have even noticed.
This is the gray failure problem, and for a multi-tenant platform it is a resilience and a communication problem at once. You cannot shift away from an impairment you cannot see, and you cannot send a credible customer update that leads with recovery instead of apology.
This post continues my series on Operating at hyperscale on AWS . It covers one capability in depth: detecting that a single Availability Zone is impaired, and recovering from it. The detection half rests on a pattern AWS documents well in the Advanced Multi-AZ Resilience Patterns whitepaper; the recovery half rests on Amazon Application Recovery Controller (ARC) zonal shift.
Why aggregate metrics hide single-AZ impact
A Regional metric is an average, and an average with one bad term out of three is still a decent-looking number. If you alarm on the Regional aggregate, you need the impaired zone to drag the whole workload below threshold before you see it, by which point the impact is severe. The fix is to stop averaging across zones and start comparing zones against each other.
The unit of measurement has to become per Availability Zone, and the question has to become comparative: is one zone an outlier against the others? That reframing is what makes a 98% / 100% / 99.99% split visible, because the skew between zones is the signal, not the aggregate.
A practical prerequisite: your telemetry has to carry the AZ identifier. Emit a dimension like
AZ-ID (the AZ ID such as use1-az1 , not just the AZ name, since names map to different physical zones per account) on your availability and latency metrics, and carry the same identifier as a field in your structured logs for the Contributor Insights step later. Without that AZ context, none of what follows is possible, which is why per-AZ, tenant-aware telemetry is the foundation this builds on.The three-signal detection pattern
The whitepaper's approach, which I have seen hold up in practice, is to combine three independent signals into one composite alarm per Availability Zone. Each signal rules out a different false positive.
Signal 1: Is this AZ breaching on availability or latency? Create per-AZ CloudWatch alarms on your availability and latency metrics. Use a one-minute period, and alarm two ways: three consecutive breaching datapoints (a sustained signal), and an "M out of N" such as 3 out of 5 (a fluctuating signal). Roll these up into one availability composite and one latency composite per AZ, for example
az1-availability and az1-latency .Signal 2: Is the impact isolated to this AZ, not Regional? A single-AZ response is wrong if the problem is everywhere. Add a composite alarm that fires only when this AZ's composite is in ALARM while the other AZs' composites are in OK. That comparison is what distinguishes a zonal event from a Regional one. If every zone is unhealthy, you have a different problem, and shifting away from one zone would make it worse. In CloudWatch composite-alarm rule syntax, the isolation check for
use1-az1 reads:(ALARM("az1-availability") OR ALARM("az1-latency")) AND OK("az2-availability") AND OK("az2-latency") AND OK("az3-availability") AND OK("az3-latency")Signal 3: Is the impact more than a single instance? One bad host can skew a whole zone's metrics and make the AZ look impaired when it is not. Evacuating a zone to deal with one sick instance is a massive overreaction, replacing the instance is faster and cheaper. Use CloudWatch Contributor Insights to count how many distinct instances are contributing to the errors. Create a rule keyed on
InstanceId , filtered to 5xx responses in the AZ:{ "AggregateOn": "Count", "Contribution": { "Filters": [ { "Match": "$.InstanceId", "IsPresent": true }, { "Match": "$.HttpStatusCode", "GreaterThan": 499 }, { "Match": "$.HttpStatusCode", "LessThan": 600 }, { "Match": "$.azId", "In": ["use1-az1"] } ], "Keys": ["$.InstanceId"] }, "LogFormat": "JSON", "LogGroupNames": ["/your/application/log-group"], "Schema": { "Name": "CloudWatchLogRule", "Version": 1 }}Then feed its unique-contributor count into an alarm using metric math, and alarm when it exceeds a threshold (a good starting point is 5% of the fleet in that zone):
INSIGHT_RULE_METRIC("5xx-errors-use1-az1", "UniqueContributors")(One naming gotcha: Contributor Insights JSON property paths accept only letters and digits in a field name, so emit the AZ field without a hyphen, for example
azId , if you want to filter on it this way.) A greater-than comparison confirms the impact is broad enough to be a real zonal event rather than one unlucky host, and it also means a zero-contributor reading never trips the alarm.Combine them. The final per-AZ composite, say
use1-az1-isolated-impact , fires only when Signal 1 (this AZ is breaching) AND Signal 3 (more than one instance) are true, qualified by Signal 2 (the other zones are healthy):ALARM("use1-az1-isolated-to-this-az") AND ALARM("not-single-instance-use1-az1")You build this stack once per AZ. The result is an alarm that means something specific and actionable: one Availability Zone is genuinely impaired, and the rest of the Region is healthy. That is the signal worth paging on, and the signal worth telling customers about.
From detection to recovery: zonal shift
Detecting the impairment precisely is only half the job. The other half is doing something about it without a human assembling the response from scratch.
That action is a zonal shift in ARC: with a single operation you move traffic away from the impaired Availability Zone and keep serving from the healthy ones. Zonal shift is supported for Application Load Balancers, Network Load Balancers, Amazon EC2 Auto Scaling groups, and Amazon EKS, and it has to be enabled per resource first (for a Network Load Balancer, for example, the
zonal_shift.config.enabled attribute). You start a shift for one AZ at a time; ARC starts the shift right away, though existing in-progress connections to the impaired zone take a short time, typically up to a few minutes, to drain.Enable zonal shift on the resource once:
aws elbv2 modify-load-balancer-attributes \ --load-balancer-arn <your-nlb-arn> \ --attributes Key=zonal_shift.config.enabled,Value=trueThen, when your
isolated-impact alarm fires, start the shift away from the impaired zone (shifts are temporary and expire; set a window that matches your response):aws arc-zonal-shift start-zonal-shift \ --resource-identifier <your-resource-arn> \ --away-from use1-az1 \ --expires-in 1h \ --comment "Single-AZ impairment detected in use1-az1"Two operational points matter for a multi-tenant platform:
- Capacity. Shifting away from a zone removes that zone's capacity from rotation. Make sure the remaining zones can absorb the load before you shift, this is why multi-AZ platforms should run with enough headroom to lose a zone. AWS also proactively removes zonal IP addresses from DNS during broad infrastructure events, so always check current AZ capacity before you add your own shift on top.
- Guard the automation against itself. If you wire the
use1-az1-isolated-impactalarm straight to an automated shift, add one safeguard above all others: the automation must check whether a zonal shift is already active before starting another. The failure mode to avoid is a cascading evacuation, the automation shifts away from AZ1, then interprets a secondary signal and shifts AZ2, then AZ3, until it has removed every zone and taken the whole workload down. One shift at a time, and never without confirming none is already in progress.
Before starting any shift, your responder should check for an active one and bail out if it finds it:
# Returns active shifts; if any exist, do NOT start another.aws arc-zonal-shift list-zonal-shifts --status ACTIVE \ --query "items[?resourceIdentifier=='<your-resource-arn>']"# Responder guard: refuse to shift if one is already active for this resource.active = azs.list_zonal_shifts(status="ACTIVE").get("items", [])if any(s["resourceIdentifier"] == resource_arn for s in active): log.warning("Zonal shift already active for %s; skipping.", resource_arn) returnazs.start_zonal_shift( resourceIdentifier=resource_arn, awayFrom=impaired_az, expiresIn="1h", comment=f"Single-AZ impairment detected in {impaired_az}",)The next step: let AWS shift for you
The most mature version of this is not writing better shift automation; it is not having to react at all. Zonal autoshift authorizes ARC to shift traffic away from an impaired AZ on your behalf, during AWS-detected events, without your alarm or your automation in the loop. You enable it per resource, and it comes with a requirement that is itself a resilience feature: ARC runs weekly practice runs, briefly shifting traffic away from a zone to prove your application still operates correctly with one zone gone. If your platform cannot survive a practice run, you have found a latent single-AZ dependency before a real event did.
The progression is a natural one: start from a multi-AZ baseline, add the three-signal detection pattern above so you can see a single-AZ impairment, wire that detection to a guarded automated shift, and finally adopt autoshift with weekly practice runs so recovery happens before you are even paged.
Why this changes the customer conversation
Detection speed is not only an availability win; it is a communication win. If you detect single-AZ impairment in minutes and shift away from it, your customer update changes from "we are investigating elevated errors" to "we detected impact isolated to one Availability Zone and traffic has already been shifted away; most tenants saw no impact, and the affected ones are recovering." The second message is one your customers can forward to their own users with confidence. You cannot write it unless you can see the impairment at the zone level and act on it, which is exactly what this pattern gives you.
Getting started
- Add the
AZ-IDdimension to your availability and latency metrics if it is not there already. Nothing works without it.
- Build the per-AZ composite alarm stack for one zone first: availability, latency, isolated-to-this-AZ, and not-a-single-instance, combined into one
isolated-impactalarm. Then replicate per zone.
- Enable zonal shift on your load balancers, Auto Scaling groups, or EKS clusters, and rehearse a manual shift during a maintenance window so the muscle memory exists.
- Wire the alarm to notification first, automation second. Start with a page to a human; add automated shift only once you have the "is a shift already active?" guard in place.
- Graduate to autoshift for the resources whose downtime hits the most tenants, and let the weekly practice runs surface your hidden single-AZ dependencies.
If you run a multi-tenant platform on AWS, the question to ask yourself is simple: if one Availability Zone degraded right now, how long before you knew, and would you find out from your dashboards or from your customers?
References (AWS documentation)
- Advanced Multi-AZ Resilience Patterns : the three-signal composite-alarm detection method
- Failure detection with CloudWatch composite alarms : per-AZ, isolated-impact, and single-instance signals
About the author: The author is an Enterprise Support Manager at AWS, supporting many of the leading independent software vendors that build their platforms on AWS. This vantage point across a portfolio of multi-tenant SaaS providers informs the generalized patterns described here; nothing in this post reflects any individual customer's confidential architecture or operations.
Series: Operating at Hyperscale (10 articles)
- …
- 8Detecting Single-AZ Impairment Before Your Customers Do This article
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article