How to find how much of my EBS allocated size I am currently using
Asked Answered
D

3

11

The size property on the DescribeVolumes returns the allocated size, but I would like to know the current used size so that I can plan for requesting an EBS size increase.

Declamation answered 8/3, 2011 at 6:22 Comment(0)
N
13

if you're looking for 'used' size, then you'll need to do this using an operating system command fired from the instance to which this EBS is attached to. On unix you can use df -Th and check the values against your mount point. On windows, you can just use the 'My Computer' page to check this

Nook answered 9/3, 2011 at 4:44 Comment(0)
C
2

It sounds like the intent of this question is to determine how much allocated EBS space you are using so you can know when you're about to hit your limit. Since Amazon has a default limit of 20T, hitting it unexpectedly (as I did) is not pleasant.

If you have the command line tools, a little bash magic gets you the answer:

t=0; for i in `ec2-describe-volumes | grep VOLUME | awk '{print $3}'`; do t=`expr $t + $i`; done; echo $t

(get the ticks right!)

Though it would be nice if amazon told you in an easy-to-find spot what your current allocated and max allowed is.

EDIT: there are now standard and provisioned iops ebs. The command above shows you the cumulative allocated of both types.

For standard ebs only:

t=0; for i in `ec2-describe-volumes | grep VOLUME | grep standard | awk '{print $3}'`; do t=`expr $t + $i`; done; echo $t

for provisioned-iops ebs only:

t=0; for i in `ec2-describe-volumes | grep VOLUME | grep io1 | awk '{print $3}'`; do t=`expr $t + $i`; done; echo $t
Cogitable answered 27/3, 2012 at 20:6 Comment(0)
T
1

Inspired by rdickeyvii@'s answer above, a simple solution summing using jq

Get all sizes

aws ec2 describe-volumes | jq '.Volumes[] | .Size'

If you just care about certain volume types:

aws ec2 describe-volumes | jq '.Volumes[] | select(.VolumeType="gp2") | [.Size] | add'

Printout with a sum using jq's add

echo "Total volume is $(aws ec2 describe-volumes | jq '.Volumes[] | select(.VolumeType="gp2") | .Size' | jq --slurp 'add') GB"

Looks like:

Total volume is 89708 GB
Telescopic answered 23/6, 2022 at 16:50 Comment(1)
Both this answer and the referenced answer from @Cogitable will return the total allocated size. The question is how much space has been used - that value is not available from the API out of the box (see "View free disk space" docs.aws.amazon.com/AWSEC2/latest/UserGuide/…). 11 years after this was asked its still not possible to view this metric by default. These days CloudWatch Logs Agent can push otherwise invisible metrics like ram/disk/swap into AWS for further processing/remote access OR Systems Manager Run command can run adhoc queries at scaleUndermanned

© 2022 - 2024 — McMap. All rights reserved.