Scope

Collect metrics and logs on supported operating systems. Outdated Amazon Linux 1 SysV service scripts and arbitrary chmod examples have been removed.

Installation and Configuration

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.

Apply Configuration

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.

Verification

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.

Official References

Configuration file and application

Powered by Fruition