Discrepancy In Amortized Cost Results: Athena Query using Cost and Usage Reports (CUR) VS AWS Cost Explorer

160 views Asked by At

I've been using AWS Athena along with Cost and Usage Reports (CUR) to check amortized costs for the past six months. When I compare the results with Cost Explorer with the amortized cost filter applied, Everything lines up perfectly for the last five months. However, there's a difference in the current month.

enter image description here

Is this because the amortization hasn't applied yet for the current month? If so, how can I get the correct amortized results?

I used this source as reference and Here's the Athena query I'm using:

SELECT
    YEAR(line_item_usage_start_date) AS year,
    MONTH(line_item_usage_start_date) AS month,
    DAY(line_item_usage_start_date) AS day,
    ROUND(SUM(
        CASE
            WHEN (line_item_line_item_type = 'SavingsPlanCoveredUsage') THEN COALESCE(savings_plan_savings_plan_effective_cost, 0)
            WHEN (line_item_line_item_type = 'SavingsPlanRecurringFee') THEN COALESCE(savings_plan_total_commitment_to_date - savings_plan_used_commitment, 0)
            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 COALESCE(reservation_effective_cost, 0)
            WHEN (line_item_line_item_type = 'RIFee') THEN COALESCE(reservation_unused_amortized_upfront_fee_for_billing_period + reservation_unused_recurring_fee, 0) 
            WHEN (line_item_line_item_type = 'Fee') THEN 0
            ELSE COALESCE(line_item_unblended_cost, 0)
        END
    ), 2) AS amortized_cost
FROM "my_cur_report"
WHERE 
    line_item_line_item_type NOT IN ('Credit') AND
    DATE(line_item_usage_start_date) >= DATE('2023-10-01')
    AND DATE(line_item_usage_start_date) <= DATE('2023-10-01')
    AND line_item_usage_account_id = 'my_acc_id'
GROUP BY 1, 2, 3
ORDER BY 1,2, 3;

Any thoughts on addressing this current month difference would be appreciated. Thanks!

0

There are 0 answers