Select Page

How we setup AWS disk usage monitoring for EC2 instances

How we setup AWS disk usage monitoring for EC2 instances

An EC2 instance without enough free disk space, can crash instantly. That’s why having a proper AWS disk usage monitoring system is vital for EC2 instances.

Amazon provides CloudWatch monitoring script for EC2 Linux-based instances. But it requires additional customization to make it effective for disk usage monitoring.

Today we’ll discuss how we setup disk usage monitoring for AWS EC2 instances using CloudWatch.

1. Install CloudWatch monitoring script

The first step is to install the CloudWatch monitoring script in the EC2 instance.

The required perl packages are installed first. Then the CloudWatch script is downloaded and installed:

 

Install CloudWatch

Install CloudWatch

 

The two main scripts that are installed are:

  1. mon-put-instance-data.pl – This script does the data collection. It collects the EC2 metrics such as memory, swap and disk utilization and sends it to the CloudWatch.
  2. mon-get-instance-stats.pl – This script generates the reports. It queries the CloudWatch and displays the utilization statistics for the EC2 instance for which the script is executed.

Read: How to update PHP to version 5.6 in AWS EC2?

2. Assign privileges to AWS user

Every AWS EC2 instance has a user assigned to it, known as the IAM (Identity and Access Management) user.

To execute CloudWatch scripts, this user should be given the required privileges. This can be done from the AWS management console to manage users.

When an access key is created for the user from the AWS console, it will also give a secret key for that user. These two keys are important for CloudWatch configuration.

 

Access key for user

Access key for user

 

The access key and the secret key for the user should be specified in the file “awscreds.template”. It may also be given in the command line while executing the scripts.

Once the keys are updated in the template file, the user should now be given the privilege to access the CloudWatch reports.

This is done via the ‘Policies’ feature for Users in the AWS management console. Create a new policy for CloudWatch full access:

 

CloudWatch policy for user

CloudWatch policy for user

 

Assign this new policy to the IAM user associated with the EC2 instance:

 

Assign policy to user

Assign policy to user

 

Read: Setting up AWS for HTTP/2 support


Get a FREE consultation

Do you spend all day answering technical support queries?

Wish you had more time to focus on your business? Let us help you.

We free up your time by taking care of your customers and servers. Our engineers monitor your servers 24/7, and support your customers over help desk, live chat and phone.

Talk to our technical support specialist today to know how we can keep your service top notch!

TALK TO AN EXPERT NOW!




Bobcares provides Outsourced Hosting Support for online businesses. Our services include Outsourced Web Hosting Support, Outsourced Server Support, Outsourced Help Desk Support, Outsource Live Chat Support and Phone Support Services.

Submit a Comment

Your email address will not be published. Required fields are marked *

Bobcares
Bobcares is a server management company that helps businesses deliver uninterrupted and secure online services. Our engineers manage close to 51,500 servers that include virtualized servers, cloud infrastructure, physical server clusters, and more.
MORE ABOUT BOBCARES