Tuesday, June 6, 2017


AWS Linux Server Health Monitoring Using CloudWatch


Login In AWS Linux Instance with ec2-user or sudo user 

Install Pre-requesting packages 


1:-   sudo yum install perl-Switch perl-DateTime perl-Sys-Syslog perl-LWP-Protocol-https perl-Digest-SHA zip unzip

2:-   sudo mkdir cloudwatch; cd cloudwatch; ll

Download and Install Monitoring script


4:-    sudo curl http://aws-cloudwatch.s3.amazonaws.com/downloads/CloudWatchMonitoringScripts-1.2.1.zip -O; sudo unzip CloudWatchMonitoringScripts-1.2.1.zip;ll


Entry in Crontab for Every 5 minute

5:-   crontab -e

*/5 * * * * ~/cloudwatch/aws-scripts-mon/mon-put-instance-data.pl --mem-util --disk-space-util --disk-path=/ --from-cron
*/5 * * * * ~/cloudwatch/aws-scripts-mon/mon-put-instance-data.pl --disk-space-util --disk-path=/data2 --from-cron

Now GoTo In EC2 and Select ec2-Instance  and check IAM Role is already created or Not

(If IAM Role is already present like below screenshot then click on role ex:- click on 1-HC-Ambari)

Now Attached Policy {AllowCloudWatch} in IAM Role (1-HC-Ambari)



Then click on Attach Policy

Select AllowCloudWatch  --> Click Attach Policy


Now Goto CloudWatch & Create New Dashboard, Here we are creating with name DEV_INFRA_LINUX



Select Line 



For adding CPU Choose EC2-Per Instance Matrix (Extra)



Add New Role with IAM


IAM-->Roles-->CreateNewRole-->Select AmazonEC2-->AttachPolicy(Now or Later) AllowCloudWatch  -->RoleName



Click on Create New Role---> Select Amazon EC2 



Attach Policy (Not Compulsory Now) --> AllowCloudWatch



Now Attach IAM Role with ec2-Instance (Single or Many)
Attached Role in IAM Role  ( Select Instance-->Action-->Instance Setting-->Attched IAM role )