LPby February 2016

AWS CLI: get RDS free space

How to get free space of RDS instance using aws-cli?

Tried:

aws rds describe-db-instances | grep -i 'size|space|free|available|used'

but no result

Answers


LPby February 2016

I've found the solution:

STARTTIME="$(date -u -d '5 minutes ago' '+%Y-%m-%dT%T')"
ENDTIME="$(date -u '+%Y-%m-%dT%T')"
aws cloudwatch get-metric-statistics --namespace AWS/RDS \
--metric-name FreeStorageSpace\
--start-time $STARTTIME --end-time $ENDTIME --period 300 \
--statistics Average\
--dimensions="Name=DBInstanceIdentifier, Value=<DB_INSTANCE>"

otput sample:

{
    "Datapoints": [
        {
            "Timestamp": "2016-02-11T08:50:00Z", 
            "Average": 45698627515.73333, 
            "Unit": "Bytes"
        }
    ], 
    "Label": "FreeStorageSpace"
}

Post Status

Asked in February 2016
Viewed 3,837 times
Voted 13
Answered 1 times

Search




Leave an answer