DEV Community

Cover image for Installing and configuring the Amazon CloudWatch Agent on Amazon Linux and Ubuntu
BAKRE JAMIU
BAKRE JAMIU

Posted on

Installing and configuring the Amazon CloudWatch Agent on Amazon Linux and Ubuntu

πŸš€ Deploying Amazon CloudWatch Agent on Amazon Linux & Ubuntu

Today, I successfully installed and configured the Amazon CloudWatch Agent on both Amazon Linux and Ubuntu! 🎯

This task involved setting up system metrics and log monitoring for EC2 instances, ensuring that CPU, memory, disk usage, and application logs are seamlessly sent to Amazon CloudWatch for analysis.

Below is a step-by-step outline to achieve this on both Amazon Linux and Ubuntu.


πŸ“Œ Amazon Linux: Installing & Configuring CloudWatch Agent

1️⃣ Update the system

   sudo yum update -y
Enter fullscreen mode Exit fullscreen mode

2️⃣ Install CloudWatch Agent

   sudo yum install -y amazon-cloudwatch-agent
Enter fullscreen mode Exit fullscreen mode

3️⃣ Run the Configuration Wizard

   sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-config-wizard
Enter fullscreen mode Exit fullscreen mode

4️⃣ Start the CloudWatch Agent

   sudo systemctl enable amazon-cloudwatch-agent
   sudo systemctl start amazon-cloudwatch-agent
Enter fullscreen mode Exit fullscreen mode

5️⃣ Verify the status

   sudo systemctl status amazon-cloudwatch-agent
Enter fullscreen mode Exit fullscreen mode

Image description

Image description


πŸ“Œ Ubuntu: Installing & Configuring CloudWatch Agent

1️⃣ Update the system

   sudo apt update -y
Enter fullscreen mode Exit fullscreen mode

2️⃣ Download CloudWatch Agent

   curl -O https://s3.amazonaws.com/amazoncloudwatch-agent/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb
Enter fullscreen mode Exit fullscreen mode

3️⃣ Install the Agent

   sudo dpkg -i amazon-cloudwatch-agent.deb
Enter fullscreen mode Exit fullscreen mode

4️⃣ Run the Configuration Wizard

   sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-config-wizard
Enter fullscreen mode Exit fullscreen mode

5️⃣ Enable and Start CloudWatch Agent

   sudo systemctl enable amazon-cloudwatch-agent
   sudo systemctl start amazon-cloudwatch-agent
Enter fullscreen mode Exit fullscreen mode

6️⃣ Check the Agent Status

   sudo systemctl status amazon-cloudwatch-agent
Enter fullscreen mode Exit fullscreen mode

Image description


πŸ” Key Takeaways

βœ… Amazon CloudWatch Agent helps monitor EC2 instances and applications in real-time.

βœ… Amazon Linux supports direct installation via yum, while Ubuntu requires manual package installation.

βœ… Logs and metrics can be customized via /opt/aws/amazon-cloudwatch-agent/bin/config.json.

βœ… Using AWS Systems Manager Parameter Store, configurations can be centrally managed across multiple instances.


πŸš€ Next Steps

I’ll be diving deeper into CloudWatch Logs Insights to analyze application performance and troubleshoot issues effectively!

If you're working on AWS observability, let’s connect and share insights! What’s your experience with CloudWatch Agent? Drop your thoughts in the comments! ⬇️

AWS #CloudEngineering #AmazonLinux #Ubuntu #DevOps #CloudWatch #Monitoring

Top comments (0)