Calculating NetAmortisedCost via Cost and Usage Report

1

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.

已提问 1 年前321 查看次数
1 回答
0

AWS Cost Explorer can show cost metrics even when there are no Savings Plans (SP) or Reserved Instances (RIs) applied to your AWS resources. The Cost Explorer retrieves cost data directly from your AWS billing data and provides various metrics and visualizations to help you analyze your costs.

Here are a few reasons why you may see cost metrics in AWS Cost Explorer without any SP/RIs applied:

  1. On-Demand Instances: The majority of your AWS resource usage might be billed at on-demand rates. On-demand instances are the default pricing model, and their costs will be shown in Cost Explorer irrespective of any applied SP/RIs.

  2. Other AWS Services: AWS Cost Explorer provides cost analysis for various AWS services, including EC2, S3, RDS, Lambda, and more. Even if you don't have SP/RIs for EC2 instances, you can still see costs associated with other services.

  3. Non-Applicable SP/RIs: If you have purchased SP/RIs for specific instance families, regions, or platforms, but your usage does not match the criteria covered by those SP/RIs, the costs will not be associated with the purchased SP/RIs. In such cases, the costs will still be visible in Cost Explorer without the SP/RI discounts.

  4. Partial Coverage: If you have a mix of on-demand and SP/RI usage, the Cost Explorer will show the costs for both. The SP/RI discounts will be applied only to the corresponding eligible usage, while the remaining costs will be shown separately.

In summary, AWS Cost Explorer provides a comprehensive view of your AWS costs, including both on-demand and SP/RI usage. Even if you don't have SP/RIs applied, you can still see the costs associated with your resource usage.

已回答 10 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则