Copyright (c) 2026 MindMesh Academy. All rights reserved. This content is proprietary and may not be reproduced or distributed without permission.

3.2.1.2. CloudWatch Metrics: Namespaces, Dimensions, Resolution

3.2.1.2. CloudWatch Metrics: Namespaces, Dimensions, Resolution

Understanding how CloudWatch organizes metrics is essential for building effective alarms and dashboards.

Namespaces group related metrics. AWS services use AWS/<service> (e.g., AWS/EC2, AWS/RDS, AWS/Lambda). Custom metrics use your own namespace (e.g., MyApp/Orders).

Dimensions are key-value pairs that identify a specific metric stream. For EC2, dimensions include InstanceId, AutoScalingGroupName, ImageId. A metric + namespace + dimensions uniquely identifies a time series.

# Query CPU for a specific instance
aws cloudwatch get-metric-statistics \
  --namespace AWS/EC2 \
  --metric-name CPUUtilization \
  --dimensions Name=InstanceId,Value=i-1234567890abcdef0 \
  --start-time 2025-01-01T00:00:00Z \
  --end-time 2025-01-01T01:00:00Z \
  --period 300 --statistics Average
Resolution:
  • Standard resolution: 1-minute data points (default for AWS services). Free.
  • High resolution: 1-second data points (custom metrics only). Costs more per metric.
  • Retention: 1-second data retained for 3 hours → 1-minute for 15 days → 5-minute for 63 days → 1-hour for 455 days.

Metric math combines metrics into expressions: METRICS("m1") / METRICS("m2") * 100 calculates a percentage. Use for custom ratios like error rate (4xx + 5xx / total requests).

Exam Trap: CloudWatch stores metrics data even after the resource is terminated — for up to 15 months. But you can only query the retention tier appropriate to the data point age. If you need 1-minute data older than 15 days, it's already been aggregated to 5-minute resolution. Plan your analysis accordingly.

Alvin Varughese
Written byAlvin Varughese•Founder•15 professional certifications