aws ce get-cost-and-usage-with-resources --granularity MONTHLY returns 'for hourly granularity is 14 days' massage. #7382
-
Hi, I exec 'aws ce get-cost-and-usage-with-resources' command with --granularity MONTHLY option. Why and what is wrong? $ aws ce get-cost-and-usage-with-resources \
> --granularity MONTHLY \
> --time-period Start=2022-06-01,End=2022-09-01 \
> --filter '{"Dimensions": { "Key": "INSTANCE_TYPE", "Values": [ "UsageQuantity", "BlendedCosts", "RESOURCE_ID" ] }}' \
> --metrics "BlendedCost" "UsageQuantity" \
> --group-by Type=DIMENSION,Key=INSTANCE_TYPE Type=DIMENSION,Key=RESOURCE_ID \
> --profile mfa
An error occurred (ValidationException) when calling the GetCostAndUsageWithResources operation: start date is too old for hourly, the max supported days for hourly granularity is 14 days
$ aws --version
aws-cli/2.8.7 Python/3.9.11 Linux/5.10.16.3-microsoft-standard-WSL2 exe/x86_64.ubuntu.20 prompt/off
$ Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @suito-venus, thanks for reaching out. I researched the error you're getting and found out in the API documentation that the start date has to be within past 14 days.
The required date range seems to ignore
I understand that it can be confusing and that the behavior is inconsistent with the documentation which is why I reached out to Cost Explorer and created this Github issue in our cross-sdk repository. Please refer to that issue for tracking the request going forward. Feel free to leave any feedback there and I can pass it along to the Cost Explorer team. |
Beta Was this translation helpful? Give feedback.
Hi @suito-venus, thanks for reaching out.
I researched the error you're getting and found out in the API documentation that the start date has to be within past 14 days.
The required date range seems to ignore
granularity
as even if you're requestingMONTHLY
, it wouldn't work unless you enter the date within 14 days ago. For example, the command below would work since the range is within past 14 days: