- Newest
- Most votes
- Most comments
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/
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/
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;
Relevant content
- asked a year ago
- asked a year ago
- AWS OFFICIALUpdated 4 years ago
- AWS OFFICIALUpdated 4 years ago
