user10807138
user10807138

Reputation:

How to know RDS free storage with using AWS CLI?

I tried with below command but no luck(if I did anything wrong please let me know).

aws cloudwatch get-metric-statistics --metric-name FreeStorageSpace --start-time 2018-12-15T23:18:00Z --end-time 2018-12-16T23:18:00Z --period 60 --namespace AWS/RDS --statistics Average --dimensions Name=Instance name, value=dev

I get below output:-

{ "Datapoints": [], "Label": "FreeStorageSpace" }

Upvotes: 1

Views: 1308

Answers (2)

user10807138
user10807138

Reputation:

Yes, I did. here is my out put:-

..... ...... ..... "Timestamp": "2018-12-18T11:18:00Z", "Average": 103001828556.8, "Unit": "Bytes" }, { "Timestamp": "2018-12-17T20:18:00Z", "Average": 103001801386.66667, "Unit": "Bytes" }, { "Timestamp": "2018-12-18T01:18:00Z", "Average": 103001622664.53334, "Unit": "Bytes" } ], "Label": "FreeStorageSpace"

but here it showing 103.00162266453334 GB(My Rds instance size is only 100GB) and On AWS console, it showing 98.3456775GB

Upvotes: 0

Prabhat Singh
Prabhat Singh

Reputation: 976

Input was this :

aws cloudwatch get-metric-statistics
--region us-east-1
--metric-name FreeStorageSpace
--start-time 2018-12-15T20:05:00
--end-time 2017-12-16T20:05:00
--period 3600
--namespace AWS/RDS
--statistics Maximum
--dimensions="Name=MyDB,Value=cc-mysql-prod-db"

Output :

{
"Datapoints": [
    {
        "Timestamp": "2018-12-15T20:05:00Z",
        "Maximum": 2196401152.0,
        "Unit": "Bytes"
    },
    {
        "Timestamp": "2018-12-15T21:05:00Z",
        "Maximum": 2196433920.0,
        "Unit": "Bytes"
    },
    {
        "Timestamp": "2018-12-15T22:05:00Z",
        "Maximum": 2196401152.0,
        "Unit": "Bytes"
    },


    ...


    {
        "Timestamp": "2018-12-16T18:05:00Z",
        "Maximum": 2196405248.0,
        "Unit": "Bytes"
    },
    {
        "Timestamp": "2018-12-16T19:05:00Z",
        "Maximum": 2196405248.0,
        "Unit": "Bytes"
    },
    {
        "Timestamp": "2018-12-16T20:05:00Z",
        "Maximum": 2196433920.0,
        "Unit": "Bytes"
    }
],
"Label": "FreeStorageSpace"
    }

Can you also make sure that you are using your default region same as where the DB instance reside in aws cli and try with period maybe 300 or something ?

Upvotes: 1

Related Questions