Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS RDS Disk Space used percentage

I want to calculate the percentage of Disk space used for AWS RDS via cloudwatch metrics.

We can see the metrics for FreeStorageSpace(The amount of available storage space) Knowing the total space occupied by AWS RDS can help for calculating the same. Where to get the total space occupied since no metrics is available.

like image 695
Vishesh Kumar Singh Avatar asked Feb 06 '20 09:02

Vishesh Kumar Singh


People also ask

How do I check my AWS RDS storage utilization?

View the VolumeBytesUsed in the RDS consoleOpen the Amazon Relational Database Service console. Choose the AWS Region where you created the Aurora MySQL-Compatible DB cluster. Choose Databases from the navigation pane, and then choose the name of the DB instance that you want to monitor. Choose the Monitoring tab.

How can check RDS table size?

To check the size of each table for a particular database (in your DB instance), run the following query: mysql> SELECT table_schema "DB Name", table_name,(data_length + index_length)/1024/1024/1024 AS "TableSizeinGB" from information_schema.

How do I check free space on AWS RDS?

Using the AWS ConsoleGo to the RDS console and select the region your database is in. Click on the Show Monitoring button and pick your database instance. There will be a graph (like below image) that shows Free Storage Space.

What is the maximum size RDS volume you can have by default?

You can create MySQL, MariaDB, Oracle, and PostgreSQL RDS DB instances with up to 64 tebibytes (TiB) of storage. You can create SQL Server RDS DB instances with up to 16 TiB of storage. For this amount of storage, use the Provisioned IOPS SSD and General Purpose SSD storage types.


1 Answers

As far as I know, there's no standard CloudWatch metric for RDS occupied space percentage or total instance size, only the already mentioned FreeStorageSpace which uses bytes as a unit.

However, you can calculate the percentage by getting the total size via AWS CLI command describe-db-instances 1. The same command should also exist in RDS clients inside AWS SDKs (although I have only confirmed its existence in Python's boto3 library) 2. The output is a list of instance objects in JSON format which also contain the parameter AllocatedStorage describing the total size of the instance in Gibibytes. After converting to the same unit, you can then calculate the percentage of free storage space. Depending on your use case, you can then perform some direct action or set up a custom CloudWatch metric for the calculated percentage.

Another interesting solution which might help you was proposed by user alanc10n in a similar question 3

1 https://docs.aws.amazon.com/cli/latest/reference/rds/describe-db-instances.html

2 https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/rds.html#RDS.Client.describe_db_instances

3 https://stackoverflow.com/questions/58657063/how-do-i-get-totalstoragespace-or-usedstoragespace-metric-from-aws-rds

like image 87
Ludolph314 Avatar answered Oct 18 '22 15:10

Ludolph314