How do you get CloudWatch metrics into Prometheus or Grafana, and what does it cost?
IntermediateConceptKubernetes Monitoring, Scale & Cloud
Answer
Three options:
- Grafana CloudWatch datasource: queries CloudWatch on demand. Simple, no copying, but every panel refresh calls
GetMetricData, which is billed per metric requested. - Exporter: YACE (yet-another-cloudwatch-exporter) or the official
cloudwatch_exporterpolls the API and exposes Prometheus metrics. Lets you use PromQL and Alertmanager, but polling cost grows with metrics × dimensions × frequency, and data lags by several minutes. - CloudWatch Metric Streams: push metrics continuously via Firehose to an HTTP endpoint or vendor. Billed per metric update; good for large accounts.
# YACE discovery job (excerpt)
discovery:
jobs:
- type: AWS/SQS
regions: [eu-west-1]
period: 300
metrics:
- name: ApproximateAgeOfOldestMessage
statistics: [Maximum]
Scope by tags and namespaces; scraping "everything every minute" is a common surprise bill.
More on Kubernetes Monitoring, Scale & Cloud
What is kube-prometheus-stack and what does it install?BeginnerWhat CRDs does the Prometheus Operator provide?IntermediateHow does the Prometheus Operator decide which ServiceMonitors to load?IntermediateWhich cAdvisor container memory metric should you watch, and why?IntermediateHow do metrics-server and the custom/external metrics APIs relate to HPA?IntermediateWhich kube-state-metrics metrics do you use most?Beginner