Skip to main content

capacity_manager_metric_datas

Creates, updates, deletes, gets or lists a capacity_manager_metric_datas resource.

Overview

Namecapacity_manager_metric_datas
TypeResource
Idaws.ec2.capacity_manager_metric_datas

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
dimensionstringThe dimension values that identify this specific data point, such as account ID, region, and instance family.
metric_valuesstringThe metric values and statistics for this data point, containing the actual capacity usage numbers.
timestampstringThe timestamp for this data point, indicating when the capacity usage occurred.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_capacity_manager_metric_dataselectMetricName, StartTime, EndTime, regionPeriod, GroupBy, FilterBy, MaxResults, NextToken, DryRunRetrieves 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

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
EndTimestring (date-time)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.
MetricNamearrayThe names of the metrics to retrieve. Maximum of 10 metrics per request.
StartTimestring (date-time)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.
regionstringAWS region (default: us-east-1)
DryRunbooleanChecks 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.
FilterByarrayConditions to filter the metric data. Each filter specifies a dimension, comparison operator ('equals', 'in'), and values to match against.
GroupByarrayThe dimensions by which to group the metric data. This determines how the data is aggregated and returned.
MaxResultsintegerThe maximum number of data points to return. Valid range is 1 to 100,000. Use with NextToken for pagination of large result sets.
NextTokenstringThe token for the next page of results. Use this value in a subsequent call to retrieve additional data points.
PeriodintegerThe granularity, in seconds, of the returned data points.

SELECT examples

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.

SELECT
dimension,
metric_values,
timestamp
FROM aws.ec2.capacity_manager_metric_datas
WHERE MetricName = '{{ MetricName }}' -- required
AND StartTime = '{{ StartTime }}' -- required
AND EndTime = '{{ EndTime }}' -- required
AND region = '{{ region }}' -- required
AND Period = '{{ Period }}'
AND GroupBy = '{{ GroupBy }}'
AND FilterBy = '{{ FilterBy }}'
AND MaxResults = '{{ MaxResults }}'
AND NextToken = '{{ NextToken }}'
AND DryRun = '{{ DryRun }}'
;