Amazon has made it much easier to use the Amazon CloudWatch Agent by making it open source (https://github.com/aws/amazon-cloudwatch-agent/), available via package managers, and including a configuration wizard. Here are my notes on my initial testing.
CloudWatchAgentServerPolicy
sudo yum -y install amazon-cloudwatch-agent
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-config-wizard
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl
/opt/aws/amazon-cloudwatch-agent/bin/config.json
Example command to start the CloudWatch Agent
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl \ -a fetch-config \ -m ec2 \ -s \ -c file:/opt/aws/amazon-cloudwatch-agent/bin/config.json
Amazon also has CloudFormation templates that will pre-install and configure the Amazon CloudWatch Agent.
https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Install-CloudWatch-Agent-New-Instances-CloudFormation.html
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "cloudwatch:PutMetricData" ], "Resource": [ "*" ] }, { "Effect": "Allow", "Action": [ "cloudwatch:GetMetricStatistics" ], "Resource": [ "*" ] }, { "Effect": "Allow", "Action": [ "cloudwatch:ListMetrics" ], "Resource": [ "*" ] }, { "Effect": "Allow", "Action": [ "ec2:DescribeTags" ], "Resource": [ "*" ] } ] }
*/5 * * * * /root/aws-scripts-mon/mon-put-instance-data.pl --mem-util --mem-used --mem-avail
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/mon-scripts.html