Amazon EKS — CloudWatch Container Insights

less than 1 minute read

CloudWatch Container Insights

Container Insights collects metrics and logs from EKS clusters and sends them to CloudWatch. It’s the fastest way to get observability without installing third-party tools.


What You Get

Metric Type Examples
Cluster Node count, pod count, CPU/memory utilization
Node CPU%, memory%, network, disk
Pod CPU%, memory%, restart count
Container Resource usage per container
Service Request count, latency (with enhanced observability)

Enable Container Insights

With CloudWatch Agent (DaemonSet)

# Quick setup with eksctl addon
$ aws eks create-addon --cluster-name demo --addon-name amazon-cloudwatch-observability

With eksctl config

cloudWatch:
  clusterLogging:
    enableTypes: ["*"]

View Metrics

Go to CloudWatch Console → Container Insights → select your cluster.

# Or query via CLI
$ aws cloudwatch get-metric-data \
    --metric-data-queries '[{"Id":"cpu","MetricStat":{"Metric":{"Namespace":"ContainerInsights","MetricName":"node_cpu_utilization","Dimensions":[{"Name":"ClusterName","Value":"demo"}]},"Period":300,"Stat":"Average"}}]' \
    --start-time 2024-01-01T00:00:00Z \
    --end-time 2024-01-01T01:00:00Z

Cost Considerations

Component Cost
CloudWatch metrics $0.30 per metric/month (first 10k)
CloudWatch Logs ingestion $0.50/GB
CloudWatch Logs storage $0.03/GB/month

A 20-node cluster typically generates ~$50-100/month in CloudWatch costs. Set log retention to reduce storage costs.


Common Mistakes

Mistake Impact
Not setting log retention Logs grow forever → increasing costs
Enabling all log types High ingestion costs
Not using metric filters Paying for metrics you don’t use

What’s Next?

Open-source alternative: Prometheus & Grafana.