Calculating NetAmortisedCost via Cost and Usage Report

0

Issue:

Unable to calculate netamortisedcost from Cost and Usage Report (CUR) data But AWS Cost Explorer still shows it.

Usecase:

we ingest Cost and Usage Reports (CSV files) internally into our BI system for cost management and also do few other things on top of it.

We know that there are some columns in CUR which only comes when there is any savings plan or RIs applied for the corresponding aws account(s). If there are no savings plan / RIs applied, then AWS Cost explorer also should not show the netamortised cost calculation. Since it does, we want to understand how we can do the same using the data in cost and usage report.

We use below SQL query to generate the netamortised cost. This has been working fine for us for some months. But for some other months this returns 0 netamortisedcost while AWS Cost explorer shows this metric.

This query is for netamortisedcost calculation but is ported from wellarchitectedlabs.com for amortised cost calculation.

CASE  
  WHEN (lineitemtype = 'SavingsPlanNegation') THEN 0
  WHEN (lineitemtype = 'SavingsPlanUpfrontFee') THEN 0 
  WHEN (lineitemtype = 'SavingsPlanCoveredUsage') THEN NetSavingsPlanEffectiveCost 
  WHEN (lineitemtype = 'SavingsPlanRecurringFee') THEN (TotalCommitmentToDate - UsedCommitment) 
  WHEN (lineitemtype = 'DiscountedUsage') THEN NetEffectiveCost 
  WHEN (lineitemtype = 'RIFee') THEN (NetUnusedAmortizedUpfrontFeeForBillingPeriod + NetUnusedRecurringFee) 
  WHEN ((lineitemtype = 'Fee') AND (ReservationARN <> '')) THEN 0 
  ELSE NetUnblendedCost 
END netAmortisedCost

How AWS Cost Explorer is showing this cost metric even when there is no SP/RIs applied.

asked 2 months ago18 views
No Answers

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.

Guidelines for Answering Questions