Skip to content

EC2  >  Operations  >  get_capacity_manager_metric_data

get_capacity_manager_metric_data

Operation

get_capacity_manager_metric_data async

get_capacity_manager_metric_data(request: GetCapacityManagerMetricDataInput | GetCapacityManagerMetricDataInputDict, /, *, plugins: list[Plugin] | None = None) -> GetCapacityManagerMetricDataOutput
get_capacity_manager_metric_data(*, plugins: list[Plugin] | None = None, **kwargs: Unpack[GetCapacityManagerMetricDataInputDict]) -> GetCapacityManagerMetricDataOutput

Retrieves capacity usage metrics for your EC2 resources. Returns time-series data for metrics like unused capacity, utilization rates, and costs across On-Demand, Spot, and Capacity Reservations. Data can be grouped and filtered by various dimensions such as region, account, and instance family.

Parameters:

Name Type Description Default
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
GetCapacityManagerMetricDataOutput

An instance of GetCapacityManagerMetricDataOutput.

Input

Pass the input fields as keyword arguments, or pass a model or dictionary as the first positional argument. Pass plugins separately as a keyword argument.

Model

GetCapacityManagerMetricDataInput dataclass

Bases: _SerdeShape

Dataclass for GetCapacityManagerMetricDataInput structure.

Attributes
dry_run class-attribute instance-attribute
dry_run: bool | None = ...

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

end_time class-attribute instance-attribute
end_time: datetime | None = ...

The end time for the metric data query, in ISO 8601 format. If the end time is beyond the latest ingested data, it will be automatically adjusted to the latest available data point.

filter_by class-attribute instance-attribute
filter_by: list[CapacityManagerCondition] | None = ...

Conditions to filter the metric data. Each filter specifies a dimension, comparison operator ('equals', 'in'), and values to match against.

group_by class-attribute instance-attribute
group_by: list[str] | None = ...

The dimensions by which to group the metric data. This determines how the data is aggregated and returned.

max_results class-attribute instance-attribute
max_results: int | None = ...

The maximum number of data points to return. Valid range is 1 to 100,000. Use with NextToken for pagination of large result sets.

metric_names class-attribute instance-attribute
metric_names: list[str] | None = ...

The names of the metrics to retrieve. Maximum of 10 metrics per request.

next_token class-attribute instance-attribute
next_token: str | None = ...

The token for the next page of results. Use this value in a subsequent call to retrieve additional data points.

period class-attribute instance-attribute
period: int | None = ...

The granularity, in seconds, of the returned data points.

start_time class-attribute instance-attribute
start_time: datetime | None = ...

The start time for the metric data query, in ISO 8601 format. The time range (end time - start time) must be a multiple of the specified period.

Dictionaries

GetCapacityManagerMetricDataInputDict

Bases: TypedDict

Dictionary form of GetCapacityManagerMetricDataInput.

Attributes
dry_run instance-attribute
dry_run: bool | None

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

end_time instance-attribute
end_time: Required[datetime]

The end time for the metric data query, in ISO 8601 format. If the end time is beyond the latest ingested data, it will be automatically adjusted to the latest available data point.

filter_by instance-attribute

Conditions to filter the metric data. Each filter specifies a dimension, comparison operator ('equals', 'in'), and values to match against.

group_by instance-attribute
group_by: Sequence[str] | None

The dimensions by which to group the metric data. This determines how the data is aggregated and returned.

max_results instance-attribute
max_results: int | None

The maximum number of data points to return. Valid range is 1 to 100,000. Use with NextToken for pagination of large result sets.

metric_names instance-attribute
metric_names: Required[Sequence[str]]

The names of the metrics to retrieve. Maximum of 10 metrics per request.

next_token instance-attribute
next_token: str | None

The token for the next page of results. Use this value in a subsequent call to retrieve additional data points.

period instance-attribute
period: Required[int]

The granularity, in seconds, of the returned data points.

start_time instance-attribute
start_time: Required[datetime]

The start time for the metric data query, in ISO 8601 format. The time range (end time - start time) must be a multiple of the specified period.

Output

GetCapacityManagerMetricDataOutput dataclass

Bases: _SerdeShape

Dataclass for GetCapacityManagerMetricDataOutput structure.

Attributes

metric_data_results class-attribute instance-attribute
metric_data_results: list[MetricDataResult] | None = ...

The metric data points returned by the query. Each result contains dimension values, timestamp, and metric values with their associated statistics.

next_token class-attribute instance-attribute
next_token: str | None = ...

The token to use to retrieve the next page of results. This value is null when there are no more results to return.

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.