akirsman / Snapshots

Utilities for EBS Snapshots
12 stars 6 forks source link

Question: what size does the last column represent? GB? TB? #1

Open WinstonN opened 4 years ago

WinstonN commented 4 years ago

Hi,

Thank you so much for this script, really helpful! I have a question around the size of the volume

You have

# 1
row['VolumeSize'] * 1024 * 1024 * 1024
# 2
changed * blockSize

The value for VolumeSize is in GB - https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-snapshots.html

volume-size - The size of the volume, in GiB.

My question is, what is the size of that column? Is it based off the block size?

What I want to do, is use the AWS calculator to confirm that the size of my snapshots == the storage I am being charged for, to make sure the numbers match up. And when they do, I want to work out a cost savings, based on snapshot retention time

Thanks again!

Hummdis commented 1 year ago

The size reported is in bytes.

However, there's a problem in the script. On line 18 the blockSize variable is set to 524288, which is 512, but it's 512 KB, not bytes.

According to AWS documentation, an attached EBS volume appears to be a physical hard disk drive containing 512-byte disk sectors. Note that's 512 bytes, not Kilobytes. So, the use of 524288 is incorrect and it should be changed to just 512.

In line 35 that specifically does the changed * blockSize part, it obtains the number of EBS blocks that have changed in the snapshot. Since EBS is a 512-byte block size you need to multiply the number of changed blocks by 512 to get the amount of bytes that have changed.

asmigar commented 6 months ago

@Hummdis

The size reported is in bytes.

However, there's a problem in the script. On line 18 the blockSize variable is set to 524288, which is 512, but it's 512 KB, not bytes.

Block size and sector size are two different things. The EBS Snapshots are stored as blocks. And block size is 512KB.