Setup guide (AWS CLI)
This guide walks you through installing Enhanced Container Insights (Classic) on an existing Amazon EKS cluster by using the AWS CLI. The add-on deploys a CloudWatch agent as a DaemonSet that collects infrastructure metrics, container logs, and performance data.
Maintenance mode
Enhanced Container Insights (Classic) is in maintenance mode. For new deployments, we recommend OTel Container Insights (Recommended).
Prerequisites
Before you begin, verify that you meet the following requirements.
-
An existing Amazon EKS cluster running Kubernetes version 1.25 or later
-
Platform version
eks.1or later -
AWS CLI version 2.12.0 or later
-
kubectlconfigured to communicate with your target cluster -
IAM permissions:
eks:CreateAddon,eks:DescribeAddon,iam:CreateServiceLinkedRole,iam:CreateRole, andiam:AttachRolePolicy -
The EKS Pod Identity Agent add-on installed on your cluster, or IAM Roles for Service Accounts (IRSA) configured
-
Outbound internet access from the cluster to CloudWatch endpoints
Step 1: Create the IAM role
Create an IAM role that allows the CloudWatch agent to send data to CloudWatch.
To create the CloudWatch agent IAM role
-
Run the following command to create the role with a trust policy for EKS Pod Identity.
aws iam create-role \ --role-name EKS-CloudWatch-Agent-Role \ --assume-role-policy-document '{ "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Principal": { "Service": "pods.eks.amazonaws.com" }, "Action": ["sts:AssumeRole", "sts:TagSession"] }] }' -
Attach the
CloudWatchAgentServerPolicymanaged policy to the role.aws iam attach-role-policy \ --role-name EKS-CloudWatch-Agent-Role \ --policy-arn arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy
Step 2: Create the Pod Identity association
Associate the IAM role with the CloudWatch agent service account in your cluster.
To create the Pod Identity association
-
Run the following command. Replace
cluster-namewith the name of your Amazon EKS cluster andaccount-idwith your AWS account ID.aws eks create-pod-identity-association \ --cluster-namecluster-name\ --namespace amazon-cloudwatch \ --service-account cloudwatch-agent \ --role-arn arn:aws:iam::account-id:role/EKS-CloudWatch-Agent-Role
Step 3: Install the Amazon CloudWatch Observability add-on
Install the amazon-cloudwatch-observability add-on on your cluster.
To install the add-on
-
Run the following command. Replace
cluster-namewith the name of your Amazon EKS cluster.aws eks create-addon \ --cluster-namecluster-name\ --addon-name amazon-cloudwatch-observability \ --addon-versionv5.x.x-eksbuild.xReplace
v5.x.x-eksbuild.xwith the latest available v5.x version. Installing without--addon-versioninstalls the latest version (v6.2.0+), which activates the OTel pipeline instead of Classic.
Step 4: Verify the add-on status
Confirm that the add-on installed successfully.
To verify the add-on status
-
Run the following command. Replace
cluster-namewith the name of your Amazon EKS cluster.aws eks describe-addon \ --cluster-namecluster-name\ --addon-name amazon-cloudwatch-observability \ --query "addon.status" \ --output textThe expected output is
ACTIVE.
Step 5: Confirm agent pods are running
Verify that the CloudWatch agent pods are running in the amazon-cloudwatch
namespace.
To confirm agent pods are running
-
Run the following command.
kubectl get pods -n amazon-cloudwatch -l app.kubernetes.io/name=cloudwatch-agentAll agent pods must show
Runningstatus.
Verify data in CloudWatch
After you complete the setup, Container Insights data appears in CloudWatch within 3 to 5 minutes.
To verify Container Insights data
-
Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/
. -
In the navigation pane, choose Container Insights.
-
Verify that metrics such as
node_cpu_utilizationandpod_memory_utilizationappear for your cluster.
Troubleshooting
Use the following guidance to resolve common issues when you install Enhanced Container Insights (Classic) on Amazon EKS.
Add-on status shows CREATE_FAILED or DEGRADED
Symptom: When you run aws eks
describe-addon, the status shows CREATE_FAILED or
DEGRADED.
Cause: The add-on installation failed because of insufficient IAM permissions or a missing Pod Identity association.
Solution: Complete the following steps to resolve this issue.
-
Run the following command to check for detailed error information. Replace
cluster-namewith the name of your cluster.aws eks describe-addon \ --cluster-namecluster-name\ --addon-name amazon-cloudwatch-observability \ --query "addon.health" -
Verify that the IAM role exists and has the
CloudWatchAgentServerPolicyattached. -
Verify that the Pod Identity association targets the correct namespace (
amazon-cloudwatch) and service account (cloudwatch-agent). -
Delete the failed add-on and reinstall it after you resolve the issue.
aws eks delete-addon \ --cluster-namecluster-name\ --addon-name amazon-cloudwatch-observability
Metrics not appearing in CloudWatch after 5 minutes
Symptom: The agent pods show Running
status, but no metrics appear in CloudWatch after 5 minutes.
Cause: The agent can't send data to CloudWatch because of network restrictions or incorrect IAM permissions.
Solution: Complete the following steps to resolve this issue.
-
Verify that your VPC security groups and network ACLs allow outbound HTTPS traffic (port 443) to CloudWatch endpoints.
-
Check the agent logs for permission errors or connection timeouts.
kubectl logs -n amazon-cloudwatch -l app.kubernetes.io/name=cloudwatch-agent --tail=100 | grep -i "error\|timeout\|denied" -
Verify that the IAM role has the
CloudWatchAgentServerPolicypolicy attached and that the trust policy allowspods.eks.amazonaws.com.
Agent pods stuck in Pending or CrashLoopBackOff
Symptom: When you run kubectl get pods -n
amazon-cloudwatch, one or more pods show Pending or
CrashLoopBackOff status.
Cause: The agent pods can't start because of insufficient node resources, image pull failures, or missing permissions.
Solution: Complete the following steps to resolve this issue.
-
Check the pod events for detailed error messages.
kubectl describe pod -n amazon-cloudwatch -l app.kubernetes.io/name=cloudwatch-agent -
Verify that your nodes have sufficient CPU and memory available for the agent pods.
-
Verify that the EKS Pod Identity Agent add-on is installed and running.
kubectl get pods -n kube-system -l app.kubernetes.io/name=eks-pod-identity-agent
Next steps
Ready to upgrade? For step-by-step instructions to move from Enhanced Container Insights (Classic) to OTel Container Insights, see Migrate from Enhanced Container Insights (Classic) to OTel Container Insights.