- Newest
- Most votes
- Most comments
It looks like the reason you are seeing different results in Cost Explorer console vs. CLI command is that you have different filters applied. In Console, you are filtering on Charge Type to exclude refunds and credits. Without these exclusions in the CLI command, its possible you are getting total costs that include refunds and credits.
Try: aws ce get-cost-and-usage --time-period Start=2023-04-01,End=2023-04-11 --granularity MONTHLY --metrics BLENDED_COST --group-by Type=DIMENSION,Key=LINKED_ACCOUNT --filter Dimensions={Key=RECORD_TYPE,Values=Usage}
If you need to find all the specific record type (charge type) values, you can also use: aws ce get-dimension-values --dimension RECORD_TYPE --time-period Start=2023-04-01,End=2023-04-11
thank you, even though the command you mentioned doesn't work, syntax problem , but I could make it work using an external file:
{ "Dimensions": { "Key": "RECORD_TYPE", "Values": ["Usage","Tax","Support"] } }
-then call it with $ aws ce get-cost-and-usage --time-period Start=2023-04-09,End=2023-04-17 --granularity MONTHLY --metrics BLENDED_COST --group-by Type=DIMENSION,Key=LINKED_ACCOUNT --filter file://file.json
@vjtean saying "In the command it says End=2023-04-11 instead of End=2023-04-10" Reply: According to AWS documentation, end_date is exclusive, so in order to include 10th April into account, you must mention the day after. even if that was the problem (which is not), it clearly doesn't explain negative and lower than 0 values.
Relevant content
- asked 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
In the command it says End=2023-04-11 instead of End=2023-04-10
@vjtean: no, end_date on cli is exclusive (https://docs.aws.amazon.com/cli/latest/reference/ce/get-cost-and-usage.html#options)