The most important columns in your AWS bill - the cost metrics.

The most important columns in your AWS bill - the cost metrics.
Photo by Mika Baumeister / Unsplash

One of my earliest questions was “what do things actually cost?”  On demand usage was easily available in the unblended_cost column, but if I take all DiscountedUsage line items (ones that are covered by a reservation) and SUM(unblended_cost), it gives me 0.  What??

This is what I learned while figuring this out.


First, the code

CASE
    WHEN line_item_type = 'DiscountedUsage' THEN reservation_effective_cost
    WHEN line_item_type = 'SavingsPlanCoveredUsage' THEN savings_plan_effective_cost
    ELSE unblended_cost
END AS finops_effective_cost,
Don't sum your whole bill by this, or you'll get some looks.

This is it.  It took me a while wandering in the woods to come up with this simple little case statement.  Let's dig in a bit starting at the bottom.

lineItem/UnblendedCost

Line item details - AWS Cost and Usage Reports
Columns under the lineItem header in AWS Cost and Usage Reports are static fields that appear in all Cost and Usage Reports. They cover all of the cost and usage information for your usage. This includes the following columns:
The UnblendedCost is the UnblendedRate multiplied by the UsageAmount.

Gee, thanks.  Look, as simply as possible – this is the first column you're going to get to know in this bill when you're first introduced into this job.  If you sum this column up for the entire month, you're going to get a number that matches what the Cost Explorer says you spent that month.  

This number is the number that matters for basically all usage costs except those to which a reservation or savings plan apply.  That is to say – storage, data transfer, anything except those where line_item_type IN ("DiscountedUsage", "SavingsPlanCoveredUsage").

lineItem/LineItemType

For those line items, they've set aside several special columns.

reservation/EffectiveCost

Reservation details - AWS Cost and Usage Reports
Columns under the reservation header in AWS Cost and Usage Reports provide details about reserved resources.

Things get hairy, fast.  You're 30 seconds into my first nuts and bolts post, and we're going to talk about amortization already.  Amortization is actually pretty simple, as are many previously inscrutable finance terms when you learn what they mean.

💡
Amortization is an accounting technique used to periodically lower the book value of a loan or an intangible asset over a set period of time. Concerning a loan, amortization focuses on spreading out loan payments over time. When applied to an asset, amortization is similar to depreciation.

source - Investopedia

Amortization in our case means - we paid a lot, say $360,000 upfront for a 3 year reservation, but since we're using that over a 3 year period, our business is going to be using $10,000 of that reservation a month.  This is amortization.  It takes the otherwise huge swings in your company's expenses (in cash basis accounting) and smooths them out a little (into accrual basis accounting).  More here.

So – AWS helps you out a little with this.  We'll get into the SavingsPlan and Reservation line items in a future post, but we're talking about usage line items for which a reservation is applied here.

There are two components to reservation covered usage:

The recurring fee is pretty simple – you get charged for it every day of the term of that reservation.  It recurs.  The upfront fee is more interesting.  That's the big thing you bought at the beginning of the term.  While you could theoretically account for that giant upfront fee in the month you paid it, your Finance team is almost certainly handling it by amortizing it over the term of the reservation.

AWS helps you by taking that upfront fee and amortizing it for you as well, daily.  For a 3 year reservation with an upfront payment of $360k, they will count up the number of days in that 3 years – either 1095 or 1096 if there's a leap year – and divide 360,000 by that, roughly $330/day.

💵
Important to note – your Finance department probably does not amortize these upfront payments daily, and so your amortized numbers for February will always be lower than January or March, whereas Finance's might be equal payments each month. This is why.

Now here's where it gets really fun.  AWS takes that $330/day and makes it available in a couple of places.  One place is in the RIFee line items in the bill.  Each day you get a number of line items that pertain just to the Reservations, not the actual usage line items.  These are ones where line_item_type = "RIFee". (docs).  In those line items you have the amortized upfront payment for that day and that's pretty much it.  

The “recurring fee for usage” shows up elsewhere - in the usage line items that benefit from the reservation.  This is a little strange to me, but the docs here seem to confirm this: the amortized upfront stuff appears in the RIFee line item, the recurring costs do not.  recurringFeeForUsage docs – it only shows up in DiscountedUsage, the usage line item.

This is a lot, I know, so let's review.  You have:

Now, you can do it yourself but AWS takes those two columns in the DiscountedUsage line items and adds them together to arrive at what we call the “effective cost”.  Effective cost is the amortized upfront cost + the recurring cost.

WHEN line_item_type = 'DiscountedUsage' THEN reservation_effective_cost

savingsPlan/savingsPlanEffectiveCost

Savings Plans details - AWS Cost and Usage Reports
The SavingsPlan columns in AWS Cost and Usage Reports provide details about the ComputeSavingsPlans. SavingsPlan columns are visible if you have purchased Savings Plans. For more information about Savings Plans, see What are Savings Plans? in the

The same basic logic applies to Savings Plans, but we can get into the nuances here in the future.

WHEN line_item_type = 'SavingsPlanCoveredUsage' THEN savings_plan_effective_cost

In closing

This took me a while to figure out, so hopefully this can help make it a little bit clearer for you as you're learning your way around the CUR.  This “effective cost” column is one that we use here to present the “true” cost of resources that we use for a given billing period.