Vishesh Kumar Singh
Vishesh Kumar Singh

Reputation: 303

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.

Upvotes: 8

Views: 5036

Answers (1)

Ludolph314
Ludolph314

Reputation: 93

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 How do I get TotalStorageSpace or UsedStorageSpace metric from AWS RDS?

Upvotes: 3

Related Questions