Volume 6 · Chapter 2 — Observability and Operations
CloudWatch Metrics and Dashboards
2.1 Introduction
CloudWatch is AWS’s central monitoring and observability service, and metrics are its foundation. Nearly every AWS service automatically publishes metrics to CloudWatch, and you can publish your own application metrics too. This chapter covers how CloudWatch metrics work, the difference between infrastructure and application metrics, and how dashboards turn raw numbers into an at-a-glance view of system health - the starting point for both monitoring and the scaling policies seen earlier.
2.2 What CloudWatch Metrics Are
A CloudWatch metric is a time-ordered series of numeric data points - a measurement tracked over time, like an instance’s CPU utilization, a load balancer’s request count, or a database’s connection count. AWS services emit these automatically, so out of the box you get visibility into your infrastructure. Metrics are organized by namespace (which service) and identified by dimensions (which specific resource), and you view them aggregated over time by statistics like average, maximum, sum, or a percentile. Because metrics are compact numeric series, CloudWatch can retain and query them efficiently, making them ideal for dashboards, trend analysis, and driving alarms and auto-scaling - the numeric backbone of monitoring on AWS.
2.3 Infrastructure vs Application Metrics
There are two important categories. Infrastructure metrics are emitted automatically by AWS services - CPU, memory (with the agent), network, disk, request counts, queue depths, database connections - and tell you how the underlying resources are behaving. Application metrics are custom metrics you publish from your own code - business and application measures like payment success rate, transactions per second, checkout latency, or queue processing time - that reflect what the application is actually doing for users. Both matter: infrastructure metrics catch resource problems (an overloaded instance, a saturated database), while application metrics catch user-facing and business problems (payments failing) that infrastructure metrics might miss entirely - a service can look healthy on CPU while failing every payment. Mature teams instrument meaningful application metrics, not just the automatic infrastructure ones.
# Publish a custom application/business metric from your code.
aws cloudwatch put-metric-data --namespace "Bank/Payments" \
--metric-name PaymentSuccessRate --unit Percent --value 99.7 \
--dimensions Service=payments,Environment=prod
2.4 Percentiles and Meaningful Statistics
How you aggregate a metric matters as much as the metric itself. Averages hide problems: an average latency of 100ms can conceal that 5% of users experience 3 seconds. Percentiles reveal the real experience - the 95th or 99th percentile latency shows what your slowest users actually see, which for a bank is often what matters most. Similarly, tracking error rate (as a percentage of requests) is more meaningful than a raw error count, and request rate plus latency plus error rate together (the classic “golden signals”) give a rounded view of a service’s health. The skill is choosing statistics that reflect real user experience and system health - percentiles for latency, rates for errors - rather than averages that mask the tail where problems live.
2.5 Dashboards
Dashboards assemble metrics into a visual, at-a-glance view of system health. A good dashboard for a service shows its golden signals - request rate, error rate, and latency percentiles - alongside key infrastructure metrics and important business metrics, so an operator can see in seconds whether the system is healthy and, during an incident, quickly grasp scope and impact. Dashboards are the shared operational picture: they’re what you open first when an alert fires, what you watch during a deployment, and what gives the team a common understanding of normal versus abnormal. Well-designed dashboards focus on the signals that matter rather than overwhelming with every available metric, so the important state is immediately legible.
2.6 Banking Production Scenario
A bank builds a dashboard per service showing the golden signals - request rate, 95th/99th-percentile latency, and error rate as a percentage - plus critical business metrics like payment success rate and transaction throughput, and key infrastructure metrics like database connections and queue depth. AWS services publish infrastructure metrics automatically; the application publishes custom business metrics from its code. During a payment incident, the on-call engineer opens the payments dashboard and immediately sees error rate spiking and success rate dropping, with latency percentiles revealing whether slowness is involved - grasping scope in seconds. The same metrics also drive auto-scaling and alarms. Choosing percentiles over averages means the dashboard reflects what customers actually experience, not a misleading average.
2.7 Troubleshooting: Metric Blind Spots
Metric problems are usually blind spots or misleading aggregations. If a service is failing users but the dashboard looks fine, you’re likely watching only infrastructure metrics and missing application/business metrics - add custom metrics like success rate. If latency looks acceptable but users complain, you’re probably looking at averages hiding a bad tail - switch to 95th/99th percentiles. If you can’t tell normal from abnormal, the dashboard may be cluttered or missing the golden signals - focus it on request rate, error rate, and latency. If memory issues go unseen, remember some metrics (like memory) need the CloudWatch agent to be collected. The discipline is to instrument meaningful application metrics, aggregate with statistics that reflect real experience (percentiles, rates), and build focused dashboards around the golden signals.
What's the difference between infrastructure and application metrics, and why do percentiles matter more than averages?
Infrastructure and application metrics capture different layers of a system, and you need both. Infrastructure metrics are emitted automatically by AWS services - CPU utilization, network, disk, request counts, queue depth, database connections, and so on - and they tell you how the underlying resources are behaving, catching problems like an overloaded instance or a saturated database. Application metrics are custom metrics you publish from your own code - business and application-level measures like payment success rate, transactions per second, checkout latency, or processing time - and they reflect what the application is actually doing for users. The reason you need application metrics and not just infrastructure ones is that a service can look perfectly healthy at the infrastructure level while failing users: CPU and memory can be fine while every payment is failing due to a downstream error, and only a business metric like payment success rate would reveal it. Infrastructure metrics catch resource problems; application metrics catch user-facing and business problems that infrastructure metrics miss entirely, so mature teams instrument meaningful application metrics deliberately. On percentiles versus averages: how you aggregate a metric matters as much as the metric itself, and averages are dangerously misleading for things like latency because they hide the tail. An average latency of 100 milliseconds can conceal that 5% of users are experiencing 3 seconds - the average looks fine while a meaningful fraction of users have a terrible experience. Percentiles expose that reality: the 95th or 99th percentile latency shows what your slowest users actually experience, which is often what matters most, especially for a bank where a small percentage of very slow or failed requests can represent real customer harm and money. So I track latency as percentiles (p95, p99) rather than averages to see the tail where problems actually live, and I track errors as a rate (percentage of requests) rather than a raw count so the number is meaningful relative to traffic. Together with request rate, error rate and latency percentiles form the golden signals that give a rounded view of service health. The principle is to choose metrics and statistics that reflect real user experience and true system health - application/business metrics alongside infrastructure ones, and percentiles and rates instead of averages and raw counts - because the goal of metrics is to reveal problems, and averages of infrastructure alone routinely hide the very problems that hurt users.
Chapter Revision Notes
- CloudWatch metrics are numeric time series; AWS services emit them automatically, and you can publish custom ones.
- Infrastructure metrics (CPU, connections, queue depth) show resource health; application/business metrics (success rate, TPS) show user-facing health.
- A service can look fine on infrastructure while failing users - instrument meaningful application metrics.
- Use percentiles (p95/p99) for latency and rates for errors - averages and raw counts hide the tail where problems live.
- Dashboards assemble the golden signals (request rate, error rate, latency) plus key business/infra metrics for at-a-glance health.