4

I'm finding that the AWS Cost Explorer Console and the AWS CLI Cost Explorer are giving two separate numbers. Any reason as to why this is happening?

For example: From my console, you can see my total for Cloudtrail is $72.66

enter image description here

However, when I put these same exact metrics for CLI, my total is $72.04

enter image description here

I know this doesn't seem like a big difference, I'm only using Cloudtrail as an example, but some of my pricier services have bigger discrepancies. Is there a reason why this is the case / can something be done to make the console and CLI have matching monthly costs?

J. Patwary
  • 427
  • 1
  • 7
  • 22
  • You have applied the `RECORD_TYPE` in the request JSON. So make sure you applied the same in `Charge Type` filter in the console. You can find it on the right side `filters -> More filters` – Sriram G May 08 '20 at 07:51
  • Yes, I've tried it with multiple record type filters including without Credit + Refund but the Console price is always $72.66 – J. Patwary May 08 '20 at 14:06
  • If you download it as report in CSV, what is in it? – Sriram G May 08 '20 at 14:22
  • The excel sheet displays the following: SERVICE | CLOUDTRAIL($) | TOTAL COST ($) SERVICE TOTAL | 72.65892 | 72.65892 4/1/2020 | 72.65892 | 72.65892 – J. Patwary May 08 '20 at 15:45
  • Try setting the `--time-period` `End=2020-05-01` in your script – Sriram G May 08 '20 at 15:53

1 Answers1

6

As per the AWS CLI Command Reference, you have to add 1 extra day on your end date. So in your case, you need to get the report for the month of April (from 2020-04-01 to 2020-04-30). Now you have to add an additional 1 day to end date which will be 2020-05-01.

Sets the start and end dates for retrieving AWS costs. The start date is inclusive, but the end date is exclusive. For example, if start is 2017-01-01 and end is 2017-05-01 , then the cost and usage data is retrieved from 2017-01-01 up to and including 2017-04-30 but not including 2017-05-01

So your time period argument will be like --time-period Start=2020-04-01,End=2020-05-01

Sriram G
  • 369
  • 3
  • 14