Archive note: This article documents the legacy CloudWatch monitoring scripts used in 2019.
Because of the shared-responsibility model, AWS cannot inspect the guest operating system from beyond the hypervisor. Metrics such as memory and disk usage therefore require some configuration inside the operating system.
The best reference I found at the time is here: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/mon-scripts.html
Here is the short version for an Amazon Linux AMI:
sudo yum install -y perl-Switch perl-DateTime perl-Sys-Syslog perl-LWP-Protocol-https perl-Digest-SHA.x86_64
curl https://aws-cloudwatch.s3.amazonaws.com/downloads/CloudWatchMonitoringScripts-1.2.2.zip -O
unzip CloudWatchMonitoringScripts-1.2.2.zip
crontab -e
Add the following entry to the crontab:
*/5 * * * * /root/aws-scripts-mon/mon-put-instance-data.pl --mem-used-incl-cache-buff --mem-util --disk-space-util --disk-path=/ --from-cron


cloud / systems