Collect metrics and logs on supported operating systems. Outdated Amazon Linux 1 SysV service scripts and arbitrary chmod examples have been removed.
Install the official package matching the operating system and CPU architecture. Grant collection permissions to the EC2 instance role and specify log paths, metrics, region, and retention policy in the configuration file.
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl \
-a fetch-config -m ec2 -s \
-c file:/opt/aws/amazon-cloudwatch-agent/etc/cloudwatch-agent.json
sudo systemctl enable amazon-cloudwatch-agent
sudo systemctl status amazon-cloudwatch-agent
The configuration file must exist at the specified path. On-premises environments require different execution modes and credential configuration.
Check agent logs, data arrival times in CloudWatch, namespaces, dimensions, log groups, and streams alongside service status. Inspect permissions, networking, and file-read access in order.