Find out what OS you are running (where this is not shown in AWS Console or via the AMI) Unix: cat /etc/os-release
Policy Created: EC2_Memory_Profiling_Policy Role created: EC2_Memory_Profiling_Role
Attach role: Instances, select instance -> Actions -> Instance Settings -> Attach /Replace IAM Role, Add Role above
sudo apt-get update sudo apt-get install unzip sudo apt-get install libwww-perl libdatetime-perl Install Scripts Mkdir monitoring_scripts
Cd monitoring_scripts
curl https://aws-cloudwatch.s3.amazonaws.com/downloads/CloudWatchMonitoringScripts-1.2.2.zip -O
unzip CloudWatchMonitoringScripts-1.2.2.zip &&
rm CloudWatchMonitoringScripts-1.2.2.zip &&
cd aws-scripts-mon
The package for the monitoring scripts contains the following files: • CloudWatchClient.pm – Shared Perl module that simplifies calling Amazon CloudWatch from other scripts.
 • mon-put-instance-data.pl – Collects system metrics on an Amazon EC2 instance (memory, swap, disk space utilization) and sends them to Amazon CloudWatch.
 • mon-get-instance-stats.pl – Queries Amazon CloudWatch and displays the most recent utilization statistics for the EC2 instance on which this script is executed.
 • awscreds.template – File template for AWS credentials that stores your access key ID and secret access key.
 • LICENSE.txt – Text file containing the Apache 2.0 license.
 • NOTICE.txt – Copyright notice.
./mon-put-instance-data.pl --mem-util --verify --verbose
• Add to Crontab - runs every 5 minutes
• vi crontab -e
• */5 * * * * ~/monitoring_scripts/aws-scripts-mon/mon-put-instance-data.pl --mem-used-incl-cache-buff --mem-util --disk-space-util --disk-path=/ --from-cron
•