How to Configure CloudWATCH

June Chung
2 min readSep 15, 2020


Cloud watch is byright enabled by default (5minutes)
If you launch instances in EC2 → automatically log to cloudwatch
if you want 1 minute metrics → detailed monitoring for EC2
good video to watch :
AWS docs : ……./UserGuide/mon-scripts.html

ANYWAYS to start..
Go into EC2 instance ssh

Preconfigured packages to enable the cloudwatch metrics (Perl Modules) -> this will enable to use monitoring scripts
>> sudo yum install -y perl-Switch perl-DateTime perl-Sys-Syslog perl-LWP-Protocol-https perl-Digest-SHA.x86_64

Download custom monitoring scripts now ( these are written and provided by AWS)
>> curl -O

Unzip scripts and go into the downloaded directory
>> unzip && \
rm && \
cd aws-scripts-mon

THEN need to add roles to the EC2 instance -> in order to call other instances (this allows EC2 to write cloud logs to AWS)
>>CREATE ROLE >> Attach 1. AmazonEC2RoleforSSM 2. CloudWatchAgentAdminPolicy

Trigger the script (this will write log to cloud watch ONE TIME )
>> ./ --mem-util --mem-used-incl-cache-buff --mem-used --mem-avail

(can trigger what you want)


>> FULL ADDRESS : /home/ec2-user/aws-scripts-mon/ — mem-util — mem-used-incl-cache-buff — mem-used — mem-avail

ADD it as a cron job
>> crontab -e
>> */1 * * * * /home/ec2-user/aws-scripts-mon/ — mem-util — mem-used-incl-cache-buff — mem-used — mem-avail
>> second, minute, hour, day, week, month
>> save and check
>> crontab -l

cf. Install the awslogs by rpm package (yum)
>>yum install -y awslogs