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

demandé il y a 2 ans188 vues
2 réponses
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": {
...
  }
}
répondu il y a un an
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
répondu il y a 2 mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions