Amazon RDS FreeStorageSpace low: what is using it
In short
FreeStorageSpace is the storage an RDS instance has left, and it drops when data, binary logs, log files or temporary files grow. Compare the instance’s data size with its allocated storage to see how much is not table data, then check binary log retention first. Storage autoscaling can add space, but only up to the maximum you set.
The symptom
The FreeStorageSpace CloudWatch metric trends down or hits a low-storage event, and writes may start to fail when the instance runs out.
Diagnose it in two steps
First, compare what the tables hold with what the volume has used. On the instance, add up the data and index sizes:
SELECT table_schema,
ROUND(SUM(data_length + index_length) / 1024 / 1024 / 1024, 2) AS size_gb
FROM information_schema.tables
GROUP BY table_schema
ORDER BY size_gb DESC;
If the schemas add up to much less than the allocated storage minus FreeStorageSpace, the rest is not table data: binary logs, log files and temporary space. Second, list the binary logs the instance keeps, and how long RDS retains them:
SHOW BINARY LOGS;
CALL mysql.rds_show_configuration;
Causes and how to tell them apart
| Cause | How to tell | Fix |
|---|---|---|
| Binary logs kept too long | SHOW BINARY LOGS lists many large files, and the binlog retention hours setting is long |
Lower the retention with mysql.rds_set_configuration to what replicas and point-in-time needs require |
| Temporary tables or files | Free space drops during a heavy query or sort and recovers afterwards | Fix the query, add an index, or give the instance more storage for peaks |
| General or slow query log written to file | The log files in the RDS console are large, and the parameter group sets log output to a file | Switch the log off or to a table you rotate, and set a sensible long_query_time |
| Data growth | The schemas themselves add up to nearly all of the used storage | Archive or delete old data, or raise the storage |
Fix it
For binary logs, set a retention that fits your replicas, for example 24 hours (check the current value first, and never set it below what a replica needs):
CALL mysql.rds_set_configuration('binlog retention hours', 24);
For a data-driven fill, raise the allocated storage, or turn on storage autoscaling and set a Maximum storage threshold. Autoscaling adds storage only when its conditions are met, such as a low-storage condition that lasts for several minutes and a minimum time since the last change, and never beyond the maximum you set. A fast fill can run out before it acts, so keep an alarm of your own.
Stop it coming back
Alert on days until full, not only on the free-space figure, so a steady growth is caught weeks ahead. Review binary log retention and log settings whenever you add a replica or change a parameter group.
What WatchTower15 shows
For RDS and Aurora MySQL, WatchTower15 reads the instance’s storage figures from CloudWatch through your own collectors, splits the database’s size into tables, system, undo, temporary and binary logs, and forecasts days to full. Database storage filling up warns at 30 days and turns critical at 7, and RDS free storage low alarms on the free space. Aurora has no allocated storage, so neither is evaluated there. See Storage and growth and Amazon RDS and Aurora.