Skip to main content

fleet_metrics

Creates, updates, deletes or gets a fleet_metric resource or lists fleet_metrics in a region

Overview

Namefleet_metrics
TypeResource
DescriptionAn aggregated metric of certain devices in your fleet
Idawscc.iot.fleet_metrics

Fields

NameDatatypeDescription
metric_namestringThe name of the fleet metric
descriptionstringThe description of a fleet metric
query_stringstringThe Fleet Indexing query used by a fleet metric
periodintegerThe period of metric emission in seconds
aggregation_fieldstringThe aggregation field to perform aggregation and metric emission
query_versionstringThe version of a Fleet Indexing query used by a fleet metric
index_namestringThe index name of a fleet metric
unitstringThe unit of data points emitted by a fleet metric
aggregation_typeobjectAggregation types supported by Fleet Indexing
metric_arnstringThe Amazon Resource Number (ARN) of a fleet metric metric
creation_datestringThe creation date of a fleet metric
versionnumberThe version of a fleet metric
tagsarrayAn array of key-value pairs to apply to this resource
regionstringAWS region.

For more information, see AWS::IoT::FleetMetric.

Methods

NameResourceAccessible byRequired Params
create_resourcefleet_metricsINSERTMetricName, region
delete_resourcefleet_metricsDELETEIdentifier, region
update_resourcefleet_metricsUPDATEIdentifier, PatchDocument, region
list_resourcesfleet_metrics_list_onlySELECTregion
get_resourcefleet_metricsSELECTIdentifier, region

SELECT examples

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 = '{{ region }}' AND
Identifier = '{{ metric_name }}';

INSERT example

Use the following StackQL query and manifest file to create a new fleet_metric resource, using stack-deploy.

/*+ create */
INSERT INTO awscc.iot.fleet_metrics (
MetricName,
region
)
SELECT
'{{ metric_name }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

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 }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

DELETE example

/*+ delete */
DELETE FROM awscc.iot.fleet_metrics
WHERE
Identifier = '{{ metric_name }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

Additional Parameters

Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:

ParameterDescription
ClientToken
A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.
A client token is valid for 36 hours once used.
After that, a resource request with the same client token is treated as a new request.
If you do not specify a client token, one is generated for inclusion in the request.
RoleArn
The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.
If you do not specify a role, a temporary session is created using your AWS user credentials.
TypeVersionId
For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used.

Permissions

To operate on the fleet_metrics resource, the following permissions are required:

iot:CreateFleetMetric,
iot:DescribeFleetMetric,
iot:TagResource