Skip to content

Identifying amortized cost column in AWS cost and usage report

0

Hello, We are ingesting CUR data for our own internal BI use cases. AWS Cost Explorer user interface provides a toggle to see amortized cost and net amortized cost for a resource. We want to surface the same in our inhouse BI dashboard. So in cost and usage report CSV, which is the column which reflects the above information for a resource ? Documentation is not very clear. What would the value of this column be for resources which does not have any RIs/discounts ? Any examples would help. Thanks.

asked 4 years ago3.8K views
3 Answers
0

The following help section in the Well Architected CUR Query Library has some good explanations: https://wellarchitectedlabs.com/cost/300_labs/300_cur_queries/query_help/

Also there is an amortized cost by charge type example here as well: https://wellarchitectedlabs.com/cost/300_labs/300_cur_queries/queries/global/

AWS
answered 4 years ago
0

Depending on whether account(s) have any RI or SP discount, you would need to use different columns for this as there's no one single "amortized cost" column in CUR. Here are few examples:

  • if there are RIs and there's usage that's benefiting from their discount, you would use column "reservation/EffectiveCost"
  • for SPs there's separate column for that - "savingsPlan/SavingsPlanEffectiveCost"
  • and for anything else, you would normally use "lineItem/UnblendedCost" (unless you know exactly why you need it, "lineItem/BlendedCost" can be used in some circumstances)

As for examples, check out CUR query library as mentioned by @amazonchris earlier https://wellarchitectedlabs.com/cost/300_labs/300_cur_queries/query_help/

AWS
EXPERT
answered 4 years ago
0

updated since the links in the other answers no longer work: you can now find this example here and copied below

The punchline is that there is no line item amortized cost line in the dataset, but you can calculate one.

SELECT 
  bill_payer_account_id,
  CASE 
      WHEN (line_item_line_item_type = 'Fee' AND product_product_name = 'AWS Premium Support') THEN 'Support fee'
      WHEN (line_item_line_item_type = 'Usage' AND product_product_name = 'AWS Support (Enterprise)') THEN 'Support fee'
      WHEN (line_item_line_item_type = 'Fee' AND bill_billing_entity <> 'AWS') THEN 'Marketplace fee'
    WHEN (line_item_line_item_type = 'DiscountedUsage') THEN 'Reservation applied usage'
      ELSE line_item_line_item_type 
    END charge_type,
  DATE_FORMAT((line_item_usage_start_date),'%Y-%m') AS month_line_item_usage_start_date, 
  ROUND(SUM(CASE
      WHEN (line_item_line_item_type = 'SavingsPlanCoveredUsage') THEN savings_plan_savings_plan_effective_cost
      WHEN (line_item_line_item_type = 'SavingsPlanRecurringFee') THEN ROUND((savings_plan_total_commitment_to_date - savings_plan_used_commitment),8)
      WHEN (line_item_line_item_type = 'SavingsPlanNegation') THEN 0
      WHEN (line_item_line_item_type = 'SavingsPlanUpfrontFee') THEN 0
      WHEN (line_item_line_item_type = 'DiscountedUsage') THEN reservation_effective_cost  
      WHEN (line_item_line_item_type = 'RIFee') THEN (reservation_unused_amortized_upfront_fee_for_billing_period + reservation_unused_recurring_fee)
      WHEN ((line_item_line_item_type = 'Fee') AND (reservation_reservation_a_r_n <> '')) THEN 0 ELSE line_item_unblended_cost END),2) sum_amortized_cost
FROM 
  ${table_name} 
WHERE 
  ${date_filter} 
GROUP BY 
  bill_payer_account_id,
  2, -- month_line_item_usage_start_date
  3 -- sum_amortized_cost
ORDER BY 
  sum_amortized_cost DESC;
answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.