aws / aws-sdk

Landing page for the AWS SDKs on GitHub
https://aws.amazon.com/tools/
Other
68 stars 12 forks source link

AWS CLI Cost Manager doesn't accept RESOURCE_ID in filters #700

Closed hakimoa closed 3 months ago

hakimoa commented 4 months ago

The issue

when called with RESOURCE_ID filter aws ce get-cost-and-usage responds

An error occurred (ValidationException) when calling the GetCostAndUsage operation: Dimension RESOURCE_ID is not allowed.

Expected behaviour

Command line to reproduce

 aws ce get-cost-and-usage \
  --time-period Start="2023-12-01",End="2024-02-01" \
  --granularity DAILY \
  --metrics "BlendedCost" \
  --filter '{"And":[{"Dimensions":{"Key":"SERVICE","Values":["DynamoDB"]}},{"Dimensions":{"Key":"RESOURCE_ID","Values":["my-dynamodb-table-name"]}}]}' \
  --output json

AWS CLI version

aws-cli/2.15.19 Python/3.11.6 Darwin/23.2.0 exe/x86_64 prompt/off

RanVaknin commented 4 months ago

Hi @hakimoa ,

You opened this issue in the general cross SDK repo. Even though that at face value this seems like an API issue and not a CLI issue, I'll transfer this to the CLI repo so that someone from that team can properly triage this and if necassary upstream this request to the CostExplorer API team.

Thanks, Ran~

RyanFitzSimmonsAK commented 4 months ago

Hi @hakimoa, thanks for reaching out. I was able to reproduce this behavior. I suspect that RESOURCE_ID is only intended to work for usage of EC2 instances, although I wasn't able to get a request to succeed. I've reached out to the service team about this, and will let you know about any updates. I'm also going to move this issue back to our cross-SDK repository. Thanks!

Ticket # for internal reference : P119431434

RyanFitzSimmonsAK commented 4 months ago

It looks like resource-level data is an opt-in feature. You can enable it in the Billing and Cost Management preferences page. This documentation might help. Could you verify if you've opted in?

github-actions[bot] commented 3 months ago

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.