CloudWatch Container Insights
Container Insights collects metrics, logs, and health data from your cluster into CloudWatch.
CloudWatch Container Insights gives you observability for EKS: CPU, memory, disk, and network metrics for clusters, nodes, pods, and containers, plus centralized logs — all in CloudWatch dashboards.
What it collects
- Metrics — resource usage at every level, ready for dashboards and alarms.
- Logs — container stdout/stderr shipped to CloudWatch Logs via Fluent Bit.
- Performance events — for spotting bottlenecks and failures.
How to enable it
Install the CloudWatch Observability add-on (or the CloudWatch agent and Fluent Bit as a DaemonSet). Pods need IRSA permission to write to CloudWatch.
Example
# Enable observability via the managed add-on
aws eks create-addon \
--cluster-name demo \
--addon-name amazon-cloudwatch-observability \
--service-account-role-arn arn:aws:iam::111122223333:role/CloudWatchAgentRole
kubectl get pods -n amazon-cloudwatchWhen to use it
- An SRE team enables Container Insights to create CloudWatch dashboards showing pod CPU, memory, and network metrics without running their own Prometheus stack.
- A platform team sets up Container Insights log groups for each namespace so engineers can query application logs and metrics in a single CloudWatch view.
- An on-call engineer uses Container Insights during an incident to quickly identify which pod is consuming abnormal CPU across a 100-node cluster.
More examples
Enable Container Insights via eksctl
Enables CloudWatch Container Insights for logs and metrics on the cluster and verifies the DaemonSet agent is deployed on all nodes.
eksctl utils enable-observability \
--cluster prod \
--enable-logging \
--enable-metrics
kubectl get daemonset amazon-cloudwatch-observability-agent \
-n amazon-cloudwatchInstall CloudWatch agent via Helm
Installs the CloudWatch Observability agent via Helm, which collects Container Insights metrics and logs from every node.
helm repo add aws-observability https://aws-observability.github.io/helm-charts
helm install amazon-cloudwatch-observability \
aws-observability/amazon-cloudwatch-observability \
--namespace amazon-cloudwatch \
--create-namespace \
--set clusterName=prod \
--set region=us-east-1Query Container Insights metrics
Retrieves average pod CPU utilization from the ContainerInsights namespace for the past hour, useful for trending and alerting.
aws cloudwatch get-metric-statistics \
--namespace ContainerInsights \
--metric-name pod_cpu_utilization \
--dimensions Name=ClusterName,Value=prod \
--start-time $(date -u -d '1 hour ago' +%Y-%m-%dT%H:%M:%S) \
--end-time $(date -u +%Y-%m-%dT%H:%M:%S) \
--period 300 \
--statistics Average
Discussion