How does Amazon SES calculate AttachmentSize and DataTransfer-Out?

0

So, I have a list of 5400 users and I emailed them attachments of 550KB. Total size of the email when received is 820KB.

In billing report I got the following:

> $0.54 for sending emails to all recipients ($0.10 per thousand) - ok
> $0.44 for 3.70GB in AttachemntsSize - how did they calculate this?
> $0.36 for 4GB of DataTransfer-Out - how did they calculate this?

Is there a way to predict these calculations in future sendings?

RhymeGuy

Posted 2019-01-29T15:16:26.163

Reputation: 125

Answers

0

Your attachments of 550 KB, once embedded in an email, are most likely base64 encoded. Base64 is an encoding scheme that makes binary payload safe to pass over transport services that may not pass clean 8-bit data -- an assumption still prevalent in SMTP. Base64 coding produces 8 bits of output for each 6 bits of input, so your attachment -- encoded on the wire -- would grow to 733.33 KB, and 5400 of them would be 3.96 GB.

This is slightly higher than the billed 3.70 GB "AttachmentSize" so this is either a rounding error or SES actually bills in gibibytes (2^30 = 1,073,741,824 bytes, these are properly abbreviated GiB but very often casually abbreviated as GB) instead of actual gigabytes (10^9 = 1,000,000,000 bytes). 3.96 GB is 3.688 GiB. Either way, the billing number is very close to the predicted size, assuming base64 encoding.

And the total size of 4.0 GB transferred out seems to be very close to the same value, rounded to an even gigabyte.

Without knowing the size of the message body and headers, it's hard to say why exactly the email client is displaying a size of 820KB for the message, but assuming the message, on the wire, is indeed that size, it's still within the range of rounding errors because that adds up to somewhere in the neighborhood of 4.428 GB or 4.123 GiB (assuming it's 820 KB rather than 820 KiB, but that only introduces a margin of error of about 3% either way).


The discrepancy between gigabytes and gibibytes is the reason why hard drives and flash drives are always smaller than they should be based on what you bought -- you were probably expecting something sized in GiB but what they sell you is sized in GB. Documented examples for AWS are hard to find but at least in some cases AWS does mean GiB when they say GB. GiB-based billing is more favorable to the customer since 1 GiB has more bytes than 1 GB.

Michael - sqlbot

Posted 2019-01-29T15:16:26.163

Reputation: 1 103