3.2.3.9. Installing and Configuring Agents on EC2 Instances (AWS Systems Manager Agent [SSM Agent], CloudWatch agent)
First Principle: Agents extend AWS's capabilities directly to the EC2 instance's OS/application layers, enabling granular data collection, remote command execution, and automated configuration management.
To achieve operational excellence, automation, and monitoring, this fundamental principle moves beyond basic instance health checks.
- The AWS Systems Manager Agent (SSM Agent), often pre-installed on AMIs, is crucial for Systems Manager services, enabling Run Command (secure execution), State Manager (desired configurations), Patch Manager (OS/software patching), and Session Manager (secure shell access). Installation on unsupported AMIs uses installer scripts.
- The CloudWatch Agent collects custom metrics (e.g., memory, disk, application data) and detailed logs from instances, providing deeper insights. Configuration involves a JSON file for metrics and log groups, followed by agent installation and start.
Key Agent Capabilities:
- SSM Agent: Remote command execution, state management, patching, secure shell.
- CloudWatch Agent: Custom metrics (OS/application), detailed log collection.
Scenario: A DevOps team needs to centrally manage EC2 instances (e.g., run commands remotely, apply patches) and collect detailed application-specific metrics and logs that are not default CloudWatch metrics.
Reflection Question: How would you install and configure both the AWS Systems Manager Agent (SSM Agent) and the CloudWatch Agent on your EC2 instances to achieve comprehensive fleet management, automation, and granular monitoring?
Both agents are typically installed via user data scripts or Systems Manager Run Command. Proper configuration is vital for robust monitoring, automated operations, and effective troubleshooting, ensuring full operational visibility.
š” Tip: Agents require appropriate IAM instance profiles (e.g., AmazonSSMManagedInstanceCore
, CloudWatchAgentServerPolicy
) for AWS service interaction.