Copyright (c) 2026 MindMesh Academy. All rights reserved. This content is proprietary and may not be reproduced or distributed without permission.

2.1.4. The CloudWatch Agent: Memory, Disk, and Container Metrics

šŸ’” First Principle: AWS can only observe what runs on its infrastructure — not inside your operating system. The CloudWatch agent bridges this gap by running inside your EC2 instance (or container) and shipping OS-level metrics that AWS's hypervisor can't see.

The unified CloudWatch agent replaced the older CloudWatch Logs agent and the CloudWatch monitoring scripts. It handles both metrics and logs in a single agent, and it works on EC2, on-premises servers, and containers.

What the CloudWatch Agent Unlocks:
Metric TypeExamplesDefault (No Agent)
Memorymem_used_percent, mem_availableāŒ Not published
Diskdisk_used_percent, disk_freeāŒ Not published
Swapswap_used_percentāŒ Not published
Per-processCPU/memory per PIDāŒ Not published
Custom StatsDAny application metricāŒ Not published

Agent Configuration and Deployment: The agent is configured via a JSON configuration file. The recommended approach for fleet-wide deployment:

  1. Store the agent config in SSM Parameter Store (a standard parameter named /AmazonCloudWatch-agent)
  2. Use SSM Run Command or State Manager to install and start the agent across your fleet
  3. The agent reads its config from Parameter Store at startup

This approach means you never need to SSH into instances to configure monitoring.

Container Insights — for ECS and EKS:

PlatformHow Container Insights Works
Amazon ECSEnable Container Insights at the cluster level; CloudWatch automatically collects CPU, memory, network per task and per container
Amazon EKSDeploy the CloudWatch agent as a DaemonSet; collects metrics from the kubelet and sends to CloudWatch

Container Insights gives you visibility into:

  • Cluster-level resource utilization
  • Service-level CPU and memory
  • Task/pod-level metrics
  • Node-level metrics (EKS)

āš ļø Exam Trap: Container Insights is not enabled by default — you must explicitly enable it. For ECS, it's a cluster-level setting. For EKS, it requires deploying the CloudWatch agent DaemonSet. The exam tests whether you know the additional configuration step.

Reflection Question: Your ECS tasks are running out of memory but the default CloudWatch ECS metrics look normal. What is the most likely cause, and what action do you take?

Alvin Varughese
Written byAlvin Varughese
Founder•15 professional certifications