Cloudwatch:
To monitor AWS resources , we have cloud watch feature.
- We can monitor all AWS resources/services and our applications
- By default all AWS resources are configured to publish its metrics to cloud watch.
Cloud watch agent:
Using this we can monitor customer metrics of AWS resources.
To monitor on premises server we can install cloud watch agent in on premises.
Lets see how we can collect metrics of EC2 instance by using cloudwatch agent.
Prerequisites to start this task are as below
- Linux EC2 instance
- IAM role
Create IAM Role as below
Click on Create role as above and select EC2 as below
Click on "Permissions"
click on Review and add Role name as below
Now "Cloudwatchadmin" role is ready.
Lets start creating Amazon Linux EC2 instance
Create SG like below
and proceed further to accept default values of EC2 and launch the instance.
Now connect EC2 using Putty and download the cloudwatch agent in linux instance.
wget https://s3.amazonaws.com/amazoncloudwatch-agent/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm
Now install the same by using the command
sudo rpm -U ./amazon-cloudwatch-agent.rpm
Configure the cloudwatch agent with the help of setup wizard
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-config-wizardNow run the cloud watch agent
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 -sSelect our ec2 instance like below
Click on CreateWidget.
Now its done for memory metrics at cloud watch by installing cloudwatchagent.
Thank you for reading 👍👍👍👍👍