AWS Builder Center
Build a Color-Coded Availability Dashboard in Amazon CloudWatch

Build a Color-Coded Availability Dashboard in Amazon CloudWatch

Learn how to configure a CloudWatch gauge widget with color-coded threshold bands using metric math and horizontal annotations, so availability drops are visible at a glance instead of buried in a number.

When a human looks at a dashboard, they process color in 50 milliseconds. They process a number in 500ms. They process a line graph trend in 2-3 seconds. Color-coded thresholds turn availability from a number you have to interpret into a signal you react to. At scale, the difference between 99.9% and 99.0% availability is 10x more downtime — but on a standard graph, they look identical. A gauge with color bands makes it obvious in a glance.
What you'll build A gauge widget displaying computed availability with three color bands: Green (≥ 99.9%) — Healthy Orange (99.0–99.9%) — Degraded Red (< 99.0%) — Critical
Prerequisites An AWS account with access to  Amazon CloudWatch  Metrics representing request count and error count (custom or from an existing service)
Step 1: Create the metric math expression Open the CloudWatch console and navigate to Dashboards Add a Gauge widget Add your request count metric (m1) and error count metric (m2) Add a math expression:
This computes availability as a percentage. The  IF  guard prevents divide-by-zero blanking during zero-traffic periods. Uncheck m1 and m2 from display — only show the expression
Screenshot showing the metric query expression to calculate availability percentage

Step 2: Narrow the guage range This is the key decision. Set the guage range to 97–100 instead of 0–100. On a full scale, 99.9 and 99.0 are visually identical. A narrow range makes the needle movement dramatic. Under Options → Guage range: Min =  97 , Max =  100 
Important: Leave at least one point of headroom below your lowest threshold. If the axis minimum equals your lowest annotation value (for example, both set to 99.0), the gauge has no room below that threshold to render a filled color band — the needle can sit at the floor of the range with no visible color.
Screenshot showing the guage range configuration

Step 3: Add color annotations Under Graph options → Horizontal annotations, add three entries:
Value
Color
Fill
99.9
Green
Above
99.0
Orange
Above
97.0
Red
Above
These create the colored bands on the gauge background. Note the axis minimum (97) sits below the lowest annotation (98), giving the red band room to render.
Screenshot showing the guage color per threshold configuration

Here's a sample guage widget JSON:
{
"type": "metric",
"width": 8,
"height": 6,
"x": 0,
"y": 0,
"properties": {
"view": "gauge",
"title": "🐾 PetAdopt Availability (Gauge)",
"region": "us-west-2",
"metrics": [
[
{
"label": "Availability %",
"expression": "IF(requests > 0, 100 * (1 - errors / requests), 100)",
"period": 60
}
],
[
"PetAdoption/App",
"RequestCount",
"Service",
"PetAdopt-App",
{
"period": 60,
"stat": "Sum",
"visible": false,
"id": "requests"
}
],
[
"PetAdoption/App",
"ErrorCount",
"Service",
"PetAdopt-App",
{
"period": 60,
"stat": "Sum",
"visible": false,
"id": "errors"
}
]
],
"annotations": {
"horizontal": [
{
"value": 99.9,
"color": "#2ca02c",
"fill": "above",
"label": "Healthy (≥99.9%)"
},
{
"value": 99,
"color": "#ff7f0e",
"fill": "above",
"label": "Degraded (99.0-99.9%)"
},
{
"value": 97,
"color": "#d62728",
"fill": "above",
"label": "Critical (<99.0%)"
}
]
},
"yAxis": {
"left": {
"min": 97,
"max": 100
}
}
}
}
Result
Gauge showing green state

Gauge showing orange state

Gauge showing red state

The color registers in milliseconds — faster than reading a number. From across the room, anyone can tell whether the system is healthy, degraded, or critical.
Why it works Three choices combine: Narrow range with headroom spreads high-availability values across the full gauge arc without starving the lowest threshold Color annotations create instant visual encoding Zero-division guard keeps the gauge from blanking during quiet periods This pattern applies to any metric where small differences carry operational weight: latency percentiles, error budgets, SLO burn rates, or capacity thresholds.
Learn more See Creating and working with widgets on  CloudWatch dashboards in the Amazon CloudWatch User Guide .
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article