AWS::IoT::CustomMetric - AWS CloudFormation

AWS::IoT::CustomMetric

Use the AWS::IoT::CustomMetric resource to define a custom metric published by your devices to Device Defender. For API reference, see CreateCustomMetric and for general information, see Custom metrics.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::IoT::CustomMetric", "Properties" : { "DisplayName" : String, "MetricName" : String, "MetricType" : String, "Tags" : [ Tag, ... ] } }

YAML

Type: AWS::IoT::CustomMetric Properties: DisplayName: String MetricName: String MetricType: String Tags: - Tag

Properties

DisplayName

Field that 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.

Required: No

Type: String

Update requires: No interruption

MetricName

The name of the custom metric. This will be used in the metric report submitted from the device/thing. It shouldn't begin with aws:. Cannot be updated once it's defined.

Required: No

Type: String

Update requires: Replacement

MetricType

The type of the custom metric. Types include string-list, ip-address-list, number-list, and number.

Required: Yes

Type: String

Update requires: Replacement

Tags

Metadata that can be used to manage the custom metric.

Required: No

Type: List of Tag

Update requires: No interruption

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the custom metric name.

Fn::GetAtt

The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the Fn::GetAtt intrinsic function, see Fn::GetAtt.

MetricArn

The Amazon Resource Number (ARN) of the custom metric; for example, arn:aws-partition:iot:region:accountId:custommetric/metricName.

Examples

JSON

{ "AWSTemplateFormatVersion": "2010-09-09", "Description": "Amazon Web Services IoT CustomMetric Sample Template", "Resources": { "BatteryPercentageMetric": { "Type": "AWS::IoT::CustomMetric", "Properties": { "MetricName": "batteryPercentage", "DisplayName": "Remaining battery percentage", "MetricType": "number" } } } }

YAML

AWSTemplateFormatVersion: '2010-09-09' Description: Amazon Web Services IoT CustomMetric Sample Template Resources: BatteryPercentageMetric: Type: AWS::IoT::CustomMetric Properties: MetricName: batteryPercentage DisplayName: Remaining battery percentage MetricType: number