25

Amazon EBS snapshots capture changed blocks from a baseline, so snapshots will often be much smaller than the source volume. Billing is based on the actual size, which is nice. However, I cannot find a way to determine the snapshot actual size. ec2-describe-snaphots only provides the size of the volume that was snapshotted.

If for no other reason, I need this information to verify billing. But I'd also like to have it because I may find that by reconfiguring my volumes, and what I do with them, I can reduce the size of my incremental snapshots.

EEAA
  • 108,414
  • 18
  • 172
  • 242
Elroy Flynn
  • 520
  • 1
  • 6
  • 8

2 Answers2

20

Amazon does not currently provide a method to report on the storage used by snapshots other than the total usage and cost numbers for all snapshots in the account.

Snapshots of the same or related volumes can share storage (where blocks have not changed between snapshots) so this makes it difficult to define the size of a single snapshot.

A new snapshot only saves blocks that have been modified since the last snapshot, but it keeps pointers to the previously saved blocks that have not been modified.

If you delete a single snapshot, it would only free up the blocks that are not shared by any other snapshot (whether created before or after the one you're deleting).

Blocks on the EBS volume that have not been written to are not included in the snapshot.

Snapshot blocks are compressed before storage, further saving you in storage costs.

Eric Hammond
  • 10,901
  • 34
  • 56
  • 7
    Thanks for the extensive answer. However, it must not be TOO difficult, because amazon does it, so that they can bill it. If I thought that only 10% of my data was changing between snaps, but it was actually 90%, I'd like to know that (in a direct fashion.) – Elroy Flynn Jan 31 '12 at 03:11
  • 3
    Amazon bills for the total storage used by all snapshots in the aggregate. The difficulty is in *defining* what you mean by how much storage a single snapshot uses in such a way that it doesn't completely confuse people who don't understand the levels of indirection that are going on behind the scenes to save you money. What you ask for in your comment is actually a count of the blocks that are in one snapshot but not a specific other one. – Eric Hammond Jan 31 '12 at 04:39
  • 2
    Depending on how you define a snapshot size, you end up giving numbers that either don't add up to the total you're actually paying for (confusing) or that don't match how much less you pay when you delete a specific snapshot (also confusing). – Eric Hammond Jan 31 '12 at 04:44
  • Where do I see the "total usage and cost numbers for all snapshots in the account"? I'm trying to determine how encryption affects snapshot size. If I encrypt an EBS volume using dm-crypt, will EC2 still be able to compress it when making a snapshot, and will incremental blocks still help for subsequent snapshots? The answer affects will affect my database backup strategy. – Mark Berry Jun 18 '14 at 00:46
  • @markberry Please ask as new questions. – Eric Hammond Jun 20 '14 at 22:59
  • Done: http://serverfault.com/q/606912/166311. – Mark Berry Jun 21 '14 at 00:49
  • 1
    Sad that the situation is the same 7 years later. @EricHammond you said that it's hard to describe how much storage a snapshot uses in a way that's not confusing. That's true, but it doesn't preclude from giving, say, per-volume snapshot prices. I sure wish I knew which of my volumes' snaps are using the space and which aren't. – Dan Pritts Sep 27 '19 at 20:04
  • I suspect snapshots from multiple EBS volumes can share storage and cost if one volume was created from a snapshot of another or has a shared ancestry. – Eric Hammond Sep 28 '19 at 21:06
2

I wrote this small script for determining the snapshot's size. Right now doesn't take any params, it just gets all snapshots.

https://github.com/akirsman/Snapshots/blob/master/snapshotsSize.py

Ariel
  • 393
  • 3
  • 15
  • This is great! For others reading, this is using the "EBS Direct APIs", available since Dec 2019, to get the number of changed blocks between each two snapshots. There are some issues with the script, but these APIs should give all the info needed. – Ralf May 28 '21 at 09:06