Skip to main content

custom_metrics

Creates, updates, deletes or gets a custom_metric resource or lists custom_metrics in a region

Overview

Namecustom_metrics
TypeResource
DescriptionA custom metric published by your devices to Device Defender.
Idawscc.iot.custom_metrics

Fields

NameDatatypeDescription
metric_namestringThe name of the custom metric. This will be used in the metric report submitted from the device/thing. Shouldn't begin with aws: . Cannot be updated once defined.
display_namestringField represents a friendly name in the console for the custom metric; it doesn't have to be unique. Don't use this name as the metric identifier in the device metric report. Can be updated once defined.
metric_typestringThe type of the custom metric. Types include string-list, ip-address-list, number-list, and number.
metric_arnstringThe Amazon Resource Number (ARN) of the custom metric.
tagsarrayAn array of key-value pairs to apply to this resource.
regionstringAWS region.

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

Methods

NameResourceAccessible byRequired Params
create_resourcecustom_metricsINSERTMetricType, region
delete_resourcecustom_metricsDELETEIdentifier, region
update_resourcecustom_metricsUPDATEIdentifier, PatchDocument, region
list_resourcescustom_metrics_list_onlySELECTregion
get_resourcecustom_metricsSELECTIdentifier, region

SELECT examples

Gets all properties from an individual custom_metric.

SELECT
region,
metric_name,
display_name,
metric_type,
metric_arn,
tags
FROM awscc.iot.custom_metrics
WHERE
region = 'us-east-1' AND
Identifier = '{{ metric_name }}';

INSERT example

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

/*+ create */
INSERT INTO awscc.iot.custom_metrics (
MetricType,
region
)
SELECT
'{{ metric_type }}',
'{{ region }}';

UPDATE example

Use the following StackQL query and manifest file to update a custom_metric resource, using stack-deploy.

/*+ update */
UPDATE awscc.iot.custom_metrics
SET PatchDocument = string('{{ {
"DisplayName": display_name,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ metric_name }}';

DELETE example

/*+ delete */
DELETE FROM awscc.iot.custom_metrics
WHERE
Identifier = '{{ metric_name }}' AND
region = 'us-east-1';

Permissions

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

iot:CreateCustomMetric,
iot:TagResource