AWS Fundamentals Logo
AWS Fundamentals
L1 ConstructAWS::IoT::CustomMetric

CfnCustomMetric

Use the `AWS::IoT::CustomMetric` resource to define a custom metric published by your devices to Device Defender. For API reference, see [CreateCustomMetric](https://docs.aws.amazon.com/iot/latest/apireference/API_CreateCustomMetric.html) and for general information, see [Custom metrics](https://docs.aws.amazon.com/iot/latest/developerguide/dd-detect-custom-metrics.html) .

Import

import { CfnCustomMetric } from 'aws-cdk-lib/aws-iot';

Or use the module namespace:

import * as iot from 'aws-cdk-lib/aws-iot';
// iot.CfnCustomMetric

Properties

Configuration passed to the constructor as CfnCustomMetricProps.

metricTypeRequired
string

The type of the custom metric. Types include `string-list` , `ip-address-list` , `number-list` , and `number` . > The type `number` only takes a single metric value as an input, but when you submit the metrics value in the DeviceMetrics report, you must pass it as an array with a single value.

displayNameOptional
string

The friendly name in the console for the custom metric. This name doesn't have to be unique. Don't use this name as the metric identifier in the device metric report. You can update the friendly name after you define it.

metricNameOptional
string

The name of the custom metric. This will be used in the metric report submitted from the device/thing. The name can't begin with `aws:` . You can’t change the name after you define it.

tagsOptional
CfnTag[]

Metadata that can be used to manage the custom metric.

CloudFormation Resource

This L1 construct maps directly to the following CloudFormation resource type.

Learn AWS the Practical Way

Our bi-weekly newsletter teaches hands-on AWS fundamentals. No certification fluff - just practical knowledge.

Subscribe to Newsletter