AWS Classroom Series – 30/Sept/2020

Installing the Cloudwatch Agents on EC2

  • Cloud watch agent can help in collecting logs & metrics from ec2 instances
  • Installation steps Refer Here
  • Create an Amazon linux Ec2 instance & login into the instance
sudo rpm -i amazon-cloudwatch-agent.rpm
sudo yum install collectd -y
  • Create a configuration file
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-config-wizard
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:/opt/aws/amazon-cloudwatch-agent/bin/config.json -s
  • Refer Here
  • Install some applications on the cloudwatch ec2 instance
  • Now let this machine execute for about an hour and view the Log groups in the Cloudwatch logs and metrics for the ec2 instance
  • Refer Here for complete confiugration of cloud watch agent
  • Once the logs are generated, Naviagate to the Cloudwatch logs & observe the log groups. Verify the logs
  • Logs can be searched for insights using Log insights. Query Syntax for insights Refer Here
  • Exercise:
    • Create a cloud watch monitor installation in the form of script and add it to user data in cloudformation
    • Install jenkins and observe jenkins logs (/var/log/jenkins/) and create log group for jenkins logs.

Next Steps:

  • Migration Framework in AWS

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin