How to create Cloudwatch alarms for RDS (MySQL) on AWS

Monitoring your RDS instances is very important, and the same applies to other resources. In this article, we will create a simple alarm for an RDS MySQL instance which will check for free storage space on the instance. There are different metrics too which can be used to create alarms, click here to see the list of available metrics for RDS instances. The "FreeStorageSpace" metric checks for the storage space available on the instance and depending upon the condition specified the alarm gets triggered and sends notifications to SNS Endpoint. The "FreeStorageSpace" metric accepts the value in bytes and not percent.

Before we proceed with this article, I assume you are aware of the basics of RDS instances and already have one in your account to create alarms for.

Pre-requisites

  1. AWS Account (Create if you don’t have one).
  2. RDS MySql Instance to create an alarm for it.

What will we do?

  1. Login to AWS.
  2. Create an alarm for RDS MySql Instance.
  3. Delete the alarm.

Login to AWS

Click here to go to AWS Login Page.

You will see the login page as follows when you hit the above link. Enter your credentials to login into your AWS account.

Login page

Once you successfully login into your account you will see the AWS management console as follows.

AWS Management Console

Create an alarm for RDS MySql Instance

To create an alarm you need to first go to Cloudwatch. Search for cloud watch in the search box at the top.

Search Cloudwatch

You will see the main cloud watch dashboard as follows. Click on "Alarms" in the left panel.

Cloudwatch dashboard

Since there are no alarms in my account under the selected region we don't see anything on this page.

To create an alarm for the RDS instance you already have in your account, click on the "Create alarm" button.

Alerts page

On this page, click on the "Select metric" button.

Specify Metric and Condition

In the search box type RDS and hit the enter button to filter the metrics for RDS. Click on "RDS - > Across All Databases" to go to the page where you will see metrics related to all your database instances available in the current region.

Search RDS metric

You can select any one of the metrics available in the list to create an alarm for it. Here, I have chosen the "FreeStorageSpace" metric. Click on the "Select metric" button to proceed.

Select a metric

Under Conditions, specify a threshold value for the metriC and select the "Lesser" option. The Alarm will get triggered if the free storage space for the RDS instance goes below the specified threshold value. Click on the "Next" button to proceed.

Specify condition

On this page, you can select an SNS topic from your existing topics or create a new one. If the alarm gets triggered it will send a notification to the selected SNS topic on the endpoint subscribed to the topic.

Select SNS Topic

On the next page give a name to the alarm and add a description to it. Click on the "Next" button to proceed further.

Add name and description

Review all the configurations for the alarm and click on the "Create alarm" button.

Review the alert

Once the alarm gets created successfully you can see it on the Alarms Page. The current state of the alarm is "OK". It means the condition has not been satisfied and the free storage space on the RDS instance is still above the threshold value we specified in the alarm. If the storage space on the RDS instance goes below the threshold value we specified, the alarm will get triggered and a notification will be sent to the SNS Endpoint.

Alert- In Ok state

Delete the Alarm

When you no longer need the alarm you can delete it easily. Select the alarm to be deleted and click on the "Actions -- > Delete" button.

Delete the Alert

You will get a pop-up screen and then click on the "Delete" button which will permanently delete the alarm. Once the alarm is deleted you cannot restore it, so be careful while performing a delete operation on alarms.

Confirm deletion

Conclusion

In this article, we saw the steps to create an alarm for the RDS instance. We created an alarm that will get triggered if the free storage space on the RDS instance goes below the specified threshold value, we can choose the condition as per our requirement for the alarm. We also saw how an alarm can be easily deleted in just a few clicks.

Share this page:

0 Comment(s)