How do you keep a CloudWatch bill under control?
AdvancedProductionObservability as Code, Security & Vendor Choices
Answer
The usual top items are log ingestion, custom metrics and API calls.
- Logs: set retention on every log group (default is "never expire"), use the Infrequent Access log class for logs you rarely query, drop debug logs at the source, and avoid sending VPC Flow Logs for every ENI at full detail.
- Custom metrics: each name plus dimension combination is billed separately, so never put pod names or request IDs in dimensions. Use Embedded Metric Format (EMF) to emit metrics from logs only for the aggregates you need.
- API calls: third-party tools polling
GetMetricDataevery minute cost real money; use metric streams (Firehose) or lengthen polling intervals. - Logs Insights: priced per GB scanned, so narrow the time range and log groups.
Cost Explorer filtered by usage type (DataProcessing-Bytes, MetricMonitorUsage) shows which lever matters.
More on Observability as Code, Security & Vendor Choices
What does "observability as code" cover, and why insist on it?BeginnerHow do you manage Grafana with Terraform?IntermediateHow do you validate Alertmanager configuration in CI?BeginnerWhat does a CI pipeline for Prometheus rules look like?IntermediateRaw dashboard JSON, Jsonnet/Grafonnet or the Grafana Foundation SDK: which do you pick?AdvancedWhat are monitoring mixins and how do you consume them?Advanced