create_custom_metric
¶
create_custom_metric(
metric_name: MetricName,
metric_type: CustomMetricType,
client_request_token: ClientRequestToken,
*,
config_overrides: Optional[IoTClientConfig] = None,
display_name: Optional[CustomMetricDisplayName] = None,
tags: Optional[TagList] = None,
) -> CreateCustomMetricResponse
The IoT Device Defender detect feature will no longer be available to new customers starting August 31, 2026. If you would like to use the detect feature, sign up prior to August 31, 2026. To learn about alternatives to IoT Device Defender detect, see IoT Device Defender detect feature availability change in the IoT Device Defender Developer Guide. There is no change to IoT Device Defender audit availability.
Use this API to define a Custom Metric published by your devices to Device Defender.
Requires permission to access the CreateCustomMetric action.
Parameters:
-
metric_name(MetricName) –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. -
display_name(Optional[CustomMetricDisplayName], default:None) –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.
-
metric_type(CustomMetricType) –The type of the custom metric.
The type
numberonly 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. -
tags(Optional[TagList], default:None) –Metadata that can be used to manage the custom metric.
-
client_request_token(ClientRequestToken) –Each custom metric must have a unique client request token. If you try to create a new custom metric that already exists with a different token, an exception occurs. If you omit this value, Amazon Web Services SDKs will automatically generate a unique client request.
Raises:
-
InternalFailureException–An unexpected error has occurred.
-
InvalidRequestException–The request is not valid.
-
LimitExceededException–A limit has been exceeded.
-
ResourceAlreadyExistsException–The resource already exists.
-
ThrottlingException–The rate exceeds the limit.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_iot/_services/io_t.py
2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 | |