custom_metrics
Creates, updates, deletes or gets a custom_metric
resource or lists custom_metrics
in a region
Overview
Name | custom_metrics |
Type | Resource |
Description | A custom metric published by your devices to Device Defender. |
Id | aws.iot.custom_metrics |
Fields
Name | Datatype | Description |
---|---|---|
metric_name | string | The 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_name | string | Field 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_type | string | The type of the custom metric. Types include string-list, ip-address-list, number-list, and number. |
metric_arn | string | The Amazon Resource Number (ARN) of the custom 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 | MetricType, 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 custom_metrics
in a region.
SELECT
region,
metric_name,
display_name,
metric_type,
metric_arn,
tags
FROM aws.iot.custom_metrics
WHERE region = 'us-east-1';
Gets all properties from an individual custom_metric
.
SELECT
region,
metric_name,
display_name,
metric_type,
metric_arn,
tags
FROM aws.iot.custom_metrics
WHERE region = 'us-east-1' AND data__Identifier = '<MetricName>';
INSERT
example
Use the following StackQL query and manifest file to create a new custom_metric
resource, using stack-deploy
.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO aws.iot.custom_metrics (
MetricType,
region
)
SELECT
'{{ MetricType }}',
'{{ region }}';
/*+ create */
INSERT INTO aws.iot.custom_metrics (
MetricName,
DisplayName,
MetricType,
Tags,
region
)
SELECT
'{{ MetricName }}',
'{{ DisplayName }}',
'{{ MetricType }}',
'{{ Tags }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: custom_metric
props:
- name: MetricName
value: '{{ MetricName }}'
- name: DisplayName
value: '{{ DisplayName }}'
- name: MetricType
value: '{{ MetricType }}'
- name: Tags
value:
- Key: '{{ Key }}'
Value: '{{ Value }}'
DELETE
example
/*+ delete */
DELETE FROM aws.iot.custom_metrics
WHERE data__Identifier = '<MetricName>'
AND region = 'us-east-1';
Permissions
To operate on the custom_metrics
resource, the following permissions are required:
Create
iot:CreateCustomMetric,
iot:TagResource
Read
iot:DescribeCustomMetric,
iot:ListTagsForResource
Update
iot:UpdateCustomMetric,
iot:ListTagsForResource,
iot:UntagResource,
iot:TagResource
Delete
iot:DescribeCustomMetric,
iot:DeleteCustomMetric
List
iot:ListCustomMetrics