aws iot create-custom-metric
The IoT Device Defender detect feature will no longer be available to new customers starting August 31, 2026. AWS CLI reference
1 example 5 options Its page in the AWS CLI reference
Examples
To create a custom metric published by your devices to Device Defender
The following create-custom-metric example creates a custom metric that measures battery percentage.
aws iot create-custom-metric --metric-name "batteryPercentage" --metric-type "number" --display-name "Remaining battery percentage." --client-request-token "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"Identify--metric-nameThe name of the custom metric.--metric-typeThe type of the custom metric.--display-nameThe friendly name in the console for the custom metric.--client-request-tokenEach custom metric must have a unique client request token.Its output
{
"metricName": "batteryPercentage",
"metricArn": "arn:aws:iot:us-west-2:1234564789012:custommetric/batteryPercentage"
}For more information, see Custom metrics in the AWS IoT Core Developer Guide.
Options
--client-request-tokenEach custom metric must have a unique client request token.--display-nameThe friendly name in the console for the custom metric.--metric-nameThe name of the custom metric.--metric-typeThe type of the custom metric.--tagsMetadata that can be used to manage the custom metric.