Reputation: 529
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
Upvotes: 3
Views: 4042
Reputation: 529
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"
}
Upvotes: 10