Amazon EC2 EBS pricing over a month of dynamically allocated space? [closed]

I see http://aws.amazon.com/ebs/ which says \$0.10 per GB allocated per month. However, if I were to create a 30GB EBS image on day 1, delete it after a day and have 0GB for the rest of the month, how would I be charged?

a) 30GB allocated => \$3.00 total

OR

b) 30GB / 30 days => 1 GB monthly average => \$0.10 total

-

closed as off topic by Mark Henderson♦Dec 1 '11 at 23:48

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

Aaand some overbearing guy walks along closing a perfectly legitimate question about professional server hosting - as "off topic". His friends must dislike him. I'm certainly on-topic per serverfault.com/faq#questions – DeepSpace101 Dec 2 '11 at 1:15

For pretty much everything AWS calculates an hourly cost, and charges you based on that. Your second estimate is the correct one - as in both quantity and time (in hours) are factored into the cost - essentially, cost based on the weighted average of usage over the month.

AWS provides a value called 'EBS:VolumeUsage', which is in byte-hours. So, for instance, you may see, for a one hour period, 11811160064 byte-hours. Dividing by 1024^3 (to convert to GB-hours) will give me the number of GB allocated during that hour (in this case, 11GB).

The total byte-hours consumed in the month are summed up, and you are charged accordingly. So, for your 30GiB for 1 day example. In each 1 hour period, you consume '30*1024^3 byte-hours' (32212254720 or 30GiB-hours). Over the 24 hour period, you consume 773094113280 byte-hours (or 720GiB-hours). Presuming no additional EBS usage over the course of the month, this figure can be divided by the number of byte-hours 1GiB would consume over the month (let's say 730h/mo) to get the final cost: 1GB = 1024^3*730 = 783831531520 byte-hours (or 730GiB-hours). You have therefore consumed 0.986 GiB-month of EBS:VolumeUsage, and your bill is \$0.10. (It is rather convoluted to use byte-hours, but it uses the values that AWS quotes on their usage reports. Since the smallest possible increment on an EBS volume is 1GiB, GiB-hours should offer the same accuracy, with more reasonable numbers).

Just to complete the idea with a second example, consider the following:

Allocate 30GB for 24 hours, 10GB for 5 hours, and 5GB for 730 hours

The cost for the above works out as follows:

Usage: (30GB-h*24+10GB-h*5+5GB-h*730)/730h/mo = 6.05GB-mo

Cost: \$0.10/GB-mo * 6.05GB-mo = \$0.61

-