Call Us! [visitorlocation]
Call Us! [visitorlocation]

Need Help?

Our experts will login to your server within 30 minutes to fix urgent issues.

We will keep your servers stable, secure and fast at all times for one fixed price.

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. – 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. – 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!


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 *

AWS Support

Use your time to build great apps. Leave your servers to us.

Managing a server is time consuming. Whether you are an expert or a newbie, that is time you could use to focus on your product or service. Leave your server management to us, and use that time to focus on the growth and success of your business.

TALK TO USOr click here to learn more.