Skip to content

Difference in Cost Explorer daily cost for the account: GUI vs CLI

0

I'm writing to ask if anyone has encountered this issue before. I'm seeing a difference in account costs displayed in Cost Explorer (GUI) vs. Cost Explorer CLI, even though I'm using exactly the same filters in both cases.

GUI: Date Range: 2025-02-16 - 2025-02-16 Granularity: Daily Dimension: Linked account (I tried all possible options, but to exclude the possibility of a missing service, I selected only the account option) Aggregate costs by: Unblended costs Displayed amount: $265.51 CLI: Date Range: 2025-02-16 - 2025-02-17 (I cannot use 2025-02-16 - 2025-02-16 because it results in an error -> An error occurred (ValidationException) when calling the GetCostAndUsage operation: Start date (and hour) should be before end date (and hour)) Granularity: Daily Dimension: Linked account (Same approach as in GUI) Aggregate costs by: Unblended costs Displayed amount: $203.91 I have no idea where this discrepancy comes from, considering that the filters are exactly the same in both cases.

Any ideas on what might be wrong?

aws ce get-cost-and-usage \
>     --time-period Start=2025-02-16,End=2025-02-17 \
>     --granularity DAILY \
>     --metrics UNBLENDED_COST \
>     --group-by Type=DIMENSION,Key=LINKED_ACCOUNT \
>     --region eu-east-1
{
    "GroupDefinitions": [
        {
            "Type": "DIMENSION",
            "Key": "LINKED_ACCOUNT"
        }
    ],
    "ResultsByTime": [
        {
            "TimePeriod": {
                "Start": "2025-02-16",
                "End": "2025-02-17"
            },
            "Total": {},
            "Groups": [
                {
                    "Keys": [
                        "123213123213123"
                    ],
                    "Metrics": {
                        "UnblendedCost": {
                            "Amount": "203.9187226207",
                            "Unit": "USD"
                        }
                    }
                }
            ],
            "Estimated": true
        }
    ],
    "DimensionValueAttributes": [
        {
            "Value": "123213123213123",
            "Attributes": {
                "description": "John Doe"
            }
        }
    ]
}

GUI Enter image description here

asked 2 years ago402 views

1 Answer
0

The discrepancy you're seeing between the Cost Explorer GUI and CLI results is likely due to a few factors:

  1. Date Range: The CLI requires you to use a different end date (2025-02-17) compared to the GUI (2025-02-16). This is because the Cost Explorer API treats the end date as exclusive, meaning it doesn't include data for that day. The GUI, however, includes the end date in its calculations.

  2. Data Processing Time: Cost Explorer data is processed at different times for the GUI and API. The GUI might have more up-to-date information compared to the API, which could lead to differences in the displayed costs.

  3. Granularity and Rounding: Cost Explorer data is available with hourly and resource-level granularity, while billing data is monthly. This difference in granularity can lead to variations due to rounding.

  4. Data Refresh Rates: The GUI and API may have different data refresh rates, causing temporary discrepancies in the displayed costs.

  5. Estimated vs. Actual Costs: The API result shows that the data is estimated. The GUI might be displaying actual costs if they've been finalized, which could explain the difference.

To reconcile these differences:

  1. Try adjusting the date range in the GUI to match the API query (2025-02-16 to 2025-02-17) to see if that aligns the results.

  2. Check if there are any credits, refunds, or adjustments applied in the GUI that might not be reflected in the API data.

  3. Verify that all filters and groupings are exactly the same between GUI and CLI.

  4. Remember that the amount on your invoice is the final amount owed to AWS when discrepancies occur.

If the issue persists, it may be worth contacting AWS Support for a detailed explanation of the differences in your specific case.
Sources
Different Total Cost in Cost Explorer vs API | AWS re:Post
Knowing the differences between Billing and Cost Explorer data - AWS Billing
Estimating cost for Cost Explorer hourly granularity - AWS Cost Management

answered 2 years ago

AWS
EXPERT

reviewed 2 years 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.