By using AWS re:Post, you agree to the AWS re:Post Terms of Use

Billing Cost round off errors discrepancies

0

Hello Team,

Background:

Recently I was working for AWS billing automation for our organization account.

  1. Initially, I tried Cost explorer API method - No AWS Data Transfer cost in the service charges and round off errors with the invoice.pdf
  2. Then I tried to store the CUR report csv file in S3 bucket - round off discrepancies in all the service charges breakdown.
  3. Later I tried to export the CUR into Athena and queried the data with the decimal datatype instead of double - still the same issue.

My Question:

  1. Is there any other way to get the exact cost details from the pdf file without downloading it.
  2. Is there a way to resolve this round off discrepancies?
asked 2 months ago86 views
2 Answers
2
Accepted Answer

Thank you for your detailed question about AWS billing automation and the discrepancies you've encountered. Let me address your concerns and provide some insights.

  1. Regarding getting exact cost details from the PDF file without downloading it: Unfortunately, there isn't a direct way to extract exact cost details from the PDF invoice without downloading it. The PDF invoice is designed for human readability and doesn't have an API or programmatic access method. The most accurate representation of your charges is always the invoice itself.

  2. Addressing the round-off discrepancies: The discrepancies you're experiencing are a known issue due to the different ways AWS billing features process and present cost data. Here's why this happens and what you can do about it:

  • Different granularities: Billing data (like in invoices) is typically monthly, while Cost Explorer and Cost and Usage Reports (CUR) can provide hourly or even resource-level granularity. This difference in granularity can lead to rounding differences.

  • Data refresh rates: Different AWS billing features may have varying data refresh settings. For example, Cost Explorer might automatically reflect refunds, credits, or support fees applied after a bill is finalized, while your CUR might not if you haven't enabled automatic refresh.

  • Grouping of charges: The way charges are grouped can differ between billing features. For instance, data transfer charges might be shown separately in the Bills page but as a usage type for each service in Cost Explorer and CUR.

  • Rounding methods: Different billing features may use different rounding methods, contributing to the discrepancies you're seeing.

To minimize these discrepancies:

a) Ensure your CUR is set to automatically refresh to include post-billing adjustments. b) When using Athena to query CUR data, be aware that even using DECIMAL data type may not completely eliminate rounding issues due to the inherent differences in how the data is processed and presented. c) Remember that when discrepancies exist, the amount on your invoice is the final, authoritative amount owed to AWS.

If after reviewing these points you still believe there are significant unexplained discrepancies, it's recommended to open a support case with AWS. Provide the specific report name and billing period you'd like reviewed, and they can investigate further.

While it may not be possible to completely eliminate all rounding differences across different AWS billing features, understanding the reasons behind these discrepancies can help you better interpret and work with the cost data for your organization's billing automation efforts.
Sources
Troubleshooting Cost and Usage Reports - AWS Data Exports
Knowing the differences between Billing and Cost Explorer data - AWS Billing
Troubleshooting Cost and Usage Reports - AWS Data Exports

profile picture
answered 2 months ago
profile picture
EXPERT
reviewed 2 months ago
profile pictureAWS
EXPERT
reviewed 2 months ago
2

Hello, adding to the automated reply above, if also depends on your requirements in terms of precision and also how soon you need to collect billing data (if you can wait at least after the 5th of the month you'll have more chances that refunds and credit will have been calculated into the spend). As for the fact that there is no Data Transfer cost while using Cost explorer API, this should not be the case, you should be able to retrieve it and filter by service as following (in python):

import boto3
client = boto3.client('ce')
response = client.get_cost_and_usage(
    TimePeriod={
        'Start': '2024-09-01',
        'End': '2024-10-01'
    },
    Granularity='MONTHLY',
    Metrics=['UnblendedCost'],
    GroupBy=[
        {
            'Type': 'DIMENSION',
            'Key': 'USAGE_TYPE_GROUP'
        }
    ],
    Filter={
        'Dimensions': {
            'Key': 'USAGE_TYPE_GROUP',
            'Values': [
                'EC2: Data Transfer',
                'S3: Data Transfer',
                'RDS: Data Transfer',
                'CloudFront: Data Transfer'
            ]
        }
    }
)
AWS
answered 2 months 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.

Guidelines for Answering Questions