Closed Manoj-Paramsetti closed 4 months ago
Hi @Manoj-Paramsetti thanks for reaching out. The get_cost_and_usage command involves a call to the underlying GetCostAndUsage API. Therefore it sounds like this issue relates to the Cost Explorer service API rather than the Boto3 SDK directly. But we can try to investigate this issue and escalate it to the Cost Explorer team if necessary.
I was able to run both of your code snippets successfully, and received a NetUnblendedCost
Amount
above 0. Are you seeing different results in the AWS Console? Can you confirm that you're using the correct account/region when running your Boto3 script?
I'll also link this Cost Explorer guide for reference in case it is helpful. For further investigation on the SDK side you can get debug logs by adding boto3.set_stream_logger('')
to your script, and redact any sensitive info.
@tim-finnigan , I'm using an admin's account credentials for my management account, so I believe there is no issue with the account. Since billing is a global service, the region won't be an issue. From the debugger, it shows that aws-global is selected. As you mentioned, the issue may be from the AWS CE API because the issue I face is from the API response.
DEBUG:botocore.regions:Calling endpoint provider with parameters: {'Region': 'aws-global', 'UseDualStack': False, 'UseFIPS': False}
In some keys, the NetUnblendedCost is above 0, but for us, we have an Enterprise Discount Program discount, which will result in a negative value in my billing. I can see $X amount under Recurring, Usage, and some record types, but for the EDP, it is zero. Are you seeing different results in the AWS Console? Yes, I see a different value if I include EDP in my AWS Console, and the EDP value is -$X.
@tim-finnigan I've experimented with the metrics using UNBLENDED_COST
, and now I can see the EDP amount. Thanks for your support @tim-finnigan .
This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.
Describe the bug
I'm endeavoring to retrieve the sum I received from EDP through boto3, yet consistently getting 0 USD across all my associated accounts. Despite attempting to filter out with the RECORD_TYPE parameter, the problem persists. However, I can discern the variance from the Cost Explorer page.
Below, I've included the code snippet I used along with the corresponding output, in an attempt to visualize the EDP amount.
Expected Behavior
Use case 1: I want to see the amount I got under Enterprise Discount Program. Use case 2: Exclude EDP record type from linked accounts.
Current Behavior
Current Behavior in Use Case 1: Despite expecting a non-zero value, I consistently receive zero as the amount. Current Behavior I Encounter in Use Case 2: Even after attempting to exclude or include EDP, there's no discernible difference.
Reproduction Steps
List Record Types for all Linked Account
Exlcude EDP
Possible Solution
It appears that negative values are being assigned to 0.
Additional Information/Context
No response
SDK version used
boto3-1.34.98
Environment details (OS name and version, etc.)
Google Colab