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 | awscc.iot.fleet_metrics |
Fields
- get (all properties)
- list (identifiers only)
| 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 |
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. |
| Name | Datatype | Description |
|---|---|---|
metric_name | string | The name of the fleet metric |
region | string | AWS region. |
For more information, see AWS::IoT::FleetMetric.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | fleet_metrics | INSERT | MetricName, region |
delete_resource | fleet_metrics | DELETE | Identifier, region |
update_resource | fleet_metrics | UPDATE | Identifier, PatchDocument, region |
list_resources | fleet_metrics_list_only | SELECT | region |
get_resource | fleet_metrics | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
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 awscc.iot.fleet_metrics
WHERE
region = 'us-east-1' AND
Identifier = '{{ metric_name }}';
Lists all fleet_metrics in a region.
SELECT
region,
metric_name
FROM awscc.iot.fleet_metrics_list_only
WHERE
region = 'us-east-1';
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 awscc.iot.fleet_metrics (
MetricName,
region
)
SELECT
'{{ metric_name }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.iot.fleet_metrics (
MetricName,
Description,
QueryString,
Period,
AggregationField,
QueryVersion,
IndexName,
Unit,
AggregationType,
Tags,
region
)
SELECT
'{{ metric_name }}',
'{{ description }}',
'{{ query_string }}',
'{{ period }}',
'{{ aggregation_field }}',
'{{ query_version }}',
'{{ index_name }}',
'{{ unit }}',
'{{ aggregation_type }}',
'{{ 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: metric_name
value: '{{ metric_name }}'
- name: description
value: '{{ description }}'
- name: query_string
value: '{{ query_string }}'
- name: period
value: '{{ period }}'
- name: aggregation_field
value: '{{ aggregation_field }}'
- name: query_version
value: '{{ query_version }}'
- name: index_name
value: '{{ index_name }}'
- name: unit
value: '{{ unit }}'
- name: aggregation_type
value:
name: '{{ name }}'
values:
- '{{ values[0] }}'
- name: tags
value:
- key: '{{ key }}'
value: '{{ value }}'
UPDATE example
Use the following StackQL query and manifest file to update a fleet_metric resource, using stack-deploy.
/*+ update */
UPDATE awscc.iot.fleet_metrics
SET PatchDocument = string('{{ {
"Description": description,
"QueryString": query_string,
"Period": period,
"AggregationField": aggregation_field,
"QueryVersion": query_version,
"IndexName": index_name,
"Unit": unit,
"AggregationType": aggregation_type,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ metric_name }}';
DELETE example
/*+ delete */
DELETE FROM awscc.iot.fleet_metrics
WHERE
Identifier = '{{ metric_name }}' AND
region = 'us-east-1';
Permissions
To operate on the fleet_metrics resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
iot:CreateFleetMetric,
iot:DescribeFleetMetric,
iot:TagResource
iot:DescribeFleetMetric,
iot:ListTagsForResource
iot:UpdateFleetMetric,
iot:DescribeFleetMetric,
iot:ListTagsForResource,
iot:UntagResource,
iot:TagResource
iot:DeleteFleetMetric,
iot:DescribeFleetMetric
iot:ListFleetMetrics