Metrics, Dimensions, and Statistics
coreintermediateA CloudWatch metric is a time-ordered set of data points — one variable you watch over time, such as an EC2 instance's CPU usage. Each metric is identified by a namespace, a name, and up to thirty dimensions (name/value pairs like `InstanceId=i-0abc`). You never read the raw points directly: you ask for a statistic — Average, Sum, Maximum, a percentile — aggregated over a period you choose.
Think of it as
A metric is a labelled measuring tape and the dimensions are the label. Every unique combination of dimensions is its own tape, even when the metric name is the same — which is why you can read `Latency{Server=Prod,Region=Frankfurt}` but not `Latency{Server=Prod}` unless you published that combination too.
What we're doing: Understand why a dashboard graph goes blank when you widen the time range past two weeks.
- 1
- The period is a read-time choice, so the same stored metric can be graphed at several resolutions — but only at resolutions the data still exists at.
- 5
- Nothing was deleted. The 1-minute series aged out of its 15-day window and the same data now lives at 5-minute granularity.
Why this works: CloudWatch rolls metric data up as it ages rather than keeping every point forever. A dashboard with a hard-coded short period looks broken on long time ranges, and the fix is to match the period to the age of the data rather than to assume the metric stopped being published.
Publishing a custom metric with a new dimension value per request
Wrong
Better
What you see: The metrics bill grows in proportion to traffic, and no graph is usable — every dimension combination has exactly one data point, so there is nothing to aggregate.
Why: Every unique dimension combination is a separate metric, and custom metrics are billed per metric. A high-cardinality dimension therefore turns each request into its own billable time series with a single point — the opposite of what a metric is for. Identifiers belong in logs, where cardinality is free.
- Whole: AWS/ApplicationELB · TargetResponseTime · {LoadBalancer=app/api-lb, TargetGroup=tg-api} · p99 over 60s
- AWS/ApplicationELB — Namespace: The container. Metrics in different namespaces never aggregate together.
- TargetResponseTime — Metric name: The variable being measured over time.
- {LoadBalancer=app/api-lb, TargetGroup=tg-api} — Dimensions: Name/value pairs that are part of the identity — a different combination is a different metric.
- p99 over 60s — Statistic + period: How the points are aggregated, and over what window. Chosen at read time, not at publish time.
Metric retention and rollup
Together
Remember: namespace + name + dimensions identify a metric; every dimension combination is its own metric, so keep cardinality bounded. Statistic and period are read-time choices. Retention is tiered with rollup — 1-minute data for 15 days, 5-minute for 63 days, 1-hour for 15 months.
See also: cloudwatch logs metric filters and insights · alarms dashboards and event driven actions

