Usage Forecast Filtering Expression

0

Hi! I'm trying to get usage forecast from CLI here but i can't find the right syntax for passing values inside the --filter expression. Can anyone please help me with that? Is there a place where i can find the valid values?

In the following example i tried passing parameters as they were passed on the URL of Cost Explorer UI:

aws ce get-usage-forecast --time-period Start=2022-10-10,End=2023-01-07 --granularity MONTHLY --metric USAGE_QUANTITY --filter {"Dimensions": {"Key":"UsageTypeGroup", "Values": ["EC2: Running Hours"]}}

Response: aws ce get-usage-forecast --time-period Start=2022-10-10,End=2023-01-07 --granularity MONTHLY --metric USAGE_QUANTITY --filter {"Dimensions": {"Key":"UsageTypeGroup", "Values": ["EC2: Running Hours"]}}

asked a year ago173 views
2 Answers
1

It looks like your dimension key value is wrong. When I use USAGE_TYPE_GROUP I get a valid response:

$ aws ce get-usage-forecast --time-period Start=2023-02-01,End=2023-07-01 --granularity MONTHLY --metric USAGE_QUANTITY --filter '{"Dimensions": {"Key":"USAGE_TYPE_GROUP", "Values": ["EC2: Running Hours"]}}' | jq .

{
  "Total": {
...
  }
}
answered a year ago
1

You can find valid values in the AWS Command Line Reference. For get-usage-forecast in particular, you can find valid values here: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ce/get-usage-forecast.html

AWS
answered a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions