fleet_metrics
Creates, updates, deletes or gets a fleet_metric
resource or lists fleet_metrics
in a region
Overview
Name | fleet_metrics |
Type | Resource |
Description | An aggregated metric of certain devices in your fleet |
Id | aws.iot.fleet_metrics |
Fields
Name | Datatype | Description |
---|---|---|
metric_name | string | The name of the fleet metric |
description | string | The description of a fleet metric |
query_string | string | The Fleet Indexing query used by a fleet metric |
period | integer | The period of metric emission in seconds |
aggregation_field | string | The aggregation field to perform aggregation and metric emission |
query_version | string | The version of a Fleet Indexing query used by a fleet metric |
index_name | string | The index name of a fleet metric |
unit | string | The unit of data points emitted by a fleet metric |
aggregation_type | object | Aggregation types supported by Fleet Indexing |
metric_arn | string | The Amazon Resource Number (ARN) of a fleet metric metric |
creation_date | string | The creation date of a fleet metric |
last_modified_date | string | The last modified date of a fleet metric |
version | number | The version of a fleet metric |
tags | array | An array of key-value pairs to apply to this resource |
region | string | AWS region. |
Methods
Name | Accessible by | Required Params |
---|---|---|
create_resource | INSERT | MetricName, region |
delete_resource | DELETE | data__Identifier, region |
update_resource | UPDATE | data__Identifier, data__PatchDocument, region |
list_resources | SELECT | region |
get_resource | SELECT | data__Identifier, region |
SELECT
examples
Gets all fleet_metrics
in a region.
SELECT
region,
metric_name,
description,
query_string,
period,
aggregation_field,
query_version,
index_name,
unit,
aggregation_type,
metric_arn,
creation_date,
last_modified_date,
version,
tags
FROM aws.iot.fleet_metrics
WHERE region = 'us-east-1';
Gets all properties from an individual fleet_metric
.
SELECT
region,
metric_name,
description,
query_string,
period,
aggregation_field,
query_version,
index_name,
unit,
aggregation_type,
metric_arn,
creation_date,
last_modified_date,
version,
tags
FROM aws.iot.fleet_metrics
WHERE region = 'us-east-1' AND data__Identifier = '<MetricName>';
INSERT
example
Use the following StackQL query and manifest file to create a new fleet_metric
resource, using stack-deploy
.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO aws.iot.fleet_metrics (
MetricName,
region
)
SELECT
'{{ MetricName }}',
'{{ region }}';
/*+ create */
INSERT INTO aws.iot.fleet_metrics (
MetricName,
Description,
QueryString,
Period,
AggregationField,
QueryVersion,
IndexName,
Unit,
AggregationType,
Tags,
region
)
SELECT
'{{ MetricName }}',
'{{ Description }}',
'{{ QueryString }}',
'{{ Period }}',
'{{ AggregationField }}',
'{{ QueryVersion }}',
'{{ IndexName }}',
'{{ Unit }}',
'{{ AggregationType }}',
'{{ Tags }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: fleet_metric
props:
- name: MetricName
value: '{{ MetricName }}'
- name: Description
value: '{{ Description }}'
- name: QueryString
value: '{{ QueryString }}'
- name: Period
value: '{{ Period }}'
- name: AggregationField
value: '{{ AggregationField }}'
- name: QueryVersion
value: '{{ QueryVersion }}'
- name: IndexName
value: '{{ IndexName }}'
- name: Unit
value: '{{ Unit }}'
- name: AggregationType
value:
Name: '{{ Name }}'
Values:
- '{{ Values[0] }}'
- name: Tags
value:
- Key: '{{ Key }}'
Value: '{{ Value }}'
DELETE
example
/*+ delete */
DELETE FROM aws.iot.fleet_metrics
WHERE data__Identifier = '<MetricName>'
AND region = 'us-east-1';
Permissions
To operate on the fleet_metrics
resource, the following permissions are required:
Create
iot:CreateFleetMetric,
iot:DescribeFleetMetric,
iot:TagResource
Read
iot:DescribeFleetMetric,
iot:ListTagsForResource
Update
iot:UpdateFleetMetric,
iot:DescribeFleetMetric,
iot:ListTagsForResource,
iot:UntagResource,
iot:TagResource
Delete
iot:DeleteFleetMetric,
iot:DescribeFleetMetric
List
iot:ListFleetMetrics