How can I help prevent storage full issues by monitoring Amazon RDS free storage space?

Last updated: 2019-05-28

My Amazon Relational Database Service (Amazon RDS) instance is in a STORAGE_FULL state, and the instance is hanging. How can I monitor the available storage space for an RDS DB instance so that I can avoid running out of storage?

Short Description

Use the AWS Command Line Interface (AWS CLI) to create Amazon CloudWatch alarms that monitor free storage space. By creating CloudWatch alarms that notify you when the FreeStorageSpace metric reaches a defined threshold, you can prevent storage full issues. Doing that also helps prevent downtime that occurs when your RDS DB instance runs out of storage. If your RDS DB instance storage is already full, see How do I resolve problems that occur when Amazon RDS DB instances run out of storage?


$ aws sns create-topic --name email-notifications
$ aws sns subscribe --topic-arn arn:aws:sns:ap-southeast-1:0123456789:email-notifications --protocol email --notification-endpoint

3.    Confirm the subscription. A confirmation message is sent by email to the address that you specified.

4.    Create a CloudWatch alarm to alert you when free storage space for a DB instance is below 25 GB:

$ aws cloudwatch put-metric-alarm --alarm-name "--alarm-name rds-storage-alarm-warning" --alarm-description "Alarm when storage less then 25GB" --metric-name "FreeStorageSpace" --namespace "AWS/RDS" --statistic "Average" --unit "Bytes" --period 300 --threshold "26843545600" --comparison-operator "LessThanThreshold" --evaluation-periods 1 --alarm-actions "arn:aws:sns:ap-southeast-1:0123456789:email-notifications" --dimensions  Name=InstanceId,Value=ora-demo

Note: You must specify the value for the FreeStorageSpace parameter in bytes.

5.    Create a second (critical) CloudWatch alarm when free storage space for a DB instance is below 10 GB:

$ aws cloudwatch put-metric-alarm --alarm-name "rds-storage-alarm-critical" --alarm-description "Alarm Critical - storage less then 10GB" --metric-name "FreeStorageSpace" --namespace "AWS/RDS" --statistic "Average" --unit "Bytes" --period 300 --threshold "10737418240" --comparison-operator "LessThanThreshold" --evaluation-periods 1 --alarm-actions "arn:aws:sns:ap-southeast-1:0123456789:email-notifications" --dimensions  Name=InstanceId,Value=ora-demo

Note: After an alarm is created, the alarm state is INSUFFICIENT_DATA until the metrics populate to the alarm.

You can use the describe-alarms command to check the details and status of the alarms created:

$ aws cloudwatch describe-alarms

Did this article help you?

Anything we could improve?

Need more help?