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"]}}

질문됨 2년 전188회 조회
2개 답변
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": {
...
  }
}
답변함 일 년 전
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
답변함 2달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠