CostAndUsageQuery - AWS Billing and Cost Management

CostAndUsageQuery

Defines the parameters for retrieving AWS cost and usage data. Includes specifications for metrics, time periods, granularity, grouping dimensions, and filtering conditions.

Contents

granularity

The granularity of the retrieved data: HOURLY, DAILY, or MONTHLY.

Type: String

Valid Values: HOURLY | DAILY | MONTHLY

Required: Yes

metrics

The specific cost and usage metrics to retrieve.

Note

Valid values for CostAndUsageQuery metrics are AmortizedCost, BlendedCost, NetAmortizedCost, NetUnblendedCost, NormalizedUsageAmount, UnblendedCost, and UsageQuantity.

Type: Array of strings

Valid Values: AmortizedCost | BlendedCost | NetAmortizedCost | NetUnblendedCost | NormalizedUsageAmount | UnblendedCost | UsageQuantity | SpendCoveredBySavingsPlans | Hour | Unit | Cost

Required: Yes

timeRange

The time period for which to retrieve data. Can be specified as absolute dates or relative time periods.

Type: DateTimeRange object

Required: Yes

filter

The filter expression to be applied to the cost and usage data.

Type: Expression object

Required: No

groupBy

Specifies how to group the retrieved data, such as by SERVICE, ACCOUNT, or TAG.

Type: Array of GroupDefinition objects

Required: No

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: