capacity_manager_metric_datas
Creates, updates, deletes, gets or lists a capacity_manager_metric_datas resource.
Overview
| Name | capacity_manager_metric_datas |
| Type | Resource |
| Id | aws.ec2.capacity_manager_metric_datas |
Fields
The following fields are returned by SELECT queries:
- get_capacity_manager_metric_data
| Name | Datatype | Description |
|---|---|---|
dimension | string | The dimension values that identify this specific data point, such as account ID, region, and instance family. |
metric_values | string | The metric values and statistics for this data point, containing the actual capacity usage numbers. |
timestamp | string | The timestamp for this data point, indicating when the capacity usage occurred. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_capacity_manager_metric_data | select | MetricName, StartTime, EndTime, region | Period, GroupBy, FilterBy, MaxResults, NextToken, DryRun | 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
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.
| Name | Datatype | Description |
|---|---|---|
EndTime | string (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. |
MetricName | array | The names of the metrics to retrieve. Maximum of 10 metrics per request. |
StartTime | string (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. |
region | string | AWS region (default: us-east-1) |
DryRun | boolean | 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. |
FilterBy | array | Conditions to filter the metric data. Each filter specifies a dimension, comparison operator ('equals', 'in'), and values to match against. |
GroupBy | array | The dimensions by which to group the metric data. This determines how the data is aggregated and returned. |
MaxResults | integer | The maximum number of data points to return. Valid range is 1 to 100,000. Use with NextToken for pagination of large result sets. |
NextToken | string | The token for the next page of results. Use this value in a subsequent call to retrieve additional data points. |
Period | integer | The granularity, in seconds, of the returned data points. |
SELECT examples
- get_capacity_manager_metric_data
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 }}'
;