Install the CloudWatch Agent on Amazon Linux 2018
Install the CloudWatch Agent on Amazon Linux 2018
Befor start ๐
-
we should need to create IAM Role with “CloudWatchAgentServerPolicy” Policy.
-
This Role should be attach with EC2 before start working.
Download the CloudWatch Agent Package ๐ต๐ผ
First we need to download the agent on Amazon Linux 2018 Linux machine.
-
SSH into your Amazon Linux instance.
-
Download the CloudWatch Agent package from AWS S3:
sudo wget https://s3.amazonaws.com/amazoncloudwatch-agent/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm
Install the CloudWatch Agent: ๐ ๏ธ
-
Install the downloaded package using the rpm command
sudo rpm -U ./amazon-cloudwatch-agent.rpm
Configure the CloudWatch Agent: โ๏ธ
-
Run the configuration wizard to set up the CloudWatch Agent
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-config-wizard
-
Follow the prompts to configure the agent. You’ll be asked about the type of metrics/logs you want to monitor, destination region, etc.
Start the CloudWatch Agent: ๐
-
After configuring the agent, start it
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s
Verify Configuration: ใโ แตแตสณแถฆแถ แถฆแตแตใ
-
Verify that the CloudWatch Agent is running and sending metrics/logs to CloudWatch
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -m ec2 -a status
Next step is Optional Automatically Start on Boot (Optional):
-
To ensure the CloudWatch Agent starts automatically on boot, enable it as a service
sudo systemctl enable amazon-cloudwatch-agent
Access CloudWatch Metrics and Logs: ๐
-
Once the agent is running, you can access the metrics and logs in the AWS CloudWatch console.
-
That’s it! You’ve successfully installed and configured the CloudWatch Agent on your Amazon Linux 2018 instance. Make sure to customize the configuration as per your monitoring requirements.