---
title: "PUT /fleet-metric/{metricName}"
method: PUT
path: "/fleet-metric/{metricName}"
---

# PUT /fleet-metric/{metricName}

`PUT /fleet-metric/{metricName}`

Creates a fleet metric.

Requires permission to access the [CreateFleetMetric](https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions) action.

## Path parameters

- `metricName` string, required

## Request body

- object
  - `queryString` string, required — The search query string.
  - `aggregationType` object, required — The type of aggregation queries.
    - `name` 'Statistics' | 'Percentiles' | 'Cardinality' — The name of the aggregation type.
    - `values` AggregationTypeValue[] — A list of the values of aggregation types.
  - `period` integer, required — The time in seconds between fleet metric emissions. Range [60(1 min), 86400(1 day)] and must be multiple of 60.
  - `aggregationField` string, required — The field to aggregate.
  - `description` string — The fleet metric description.
  - `queryVersion` string — The query version.
  - `indexName` string — The name of the index to search.
  - `unit` 'Seconds' | 'Microseconds' | 'Milliseconds' | 'Bytes' | 'Kilobytes' | 'Megabytes' | 'Gigabytes' | 'Terabytes' | 'Bits' | 'Kilobits' | 'Megabits' | 'Gigabits' | 'Terabits' | 'Percent' | 'Count' | 'Bytes/Second' | 'Kilobytes/Second' | 'Megabytes/Second' | 'Gigabytes/Second' | 'Terabytes/Second' | 'Bits/Second' | 'Kilobits/Second' | 'Megabits/Second' | 'Gigabits/Second' | 'Terabits/Second' | 'Count/Second' | 'None' — Used to support unit transformation such as milliseconds to seconds. The unit must be supported by <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html">CW metric</a>. Default to null.
  - `tags` Tag[] — Metadata, which can be used to manage the fleet metric.
    - `Key` string, required — The tag's key.
    - `Value` string — The tag's value.

## Response `200`

Success

- CreateFleetMetricResponse
  - `metricName` string — The name of the fleet metric to create.
  - `metricArn` string — The Amazon Resource Name (ARN) of the new fleet metric.

## Other responses

- `480` — InvalidRequestException
- `481` — ThrottlingException
- `482` — UnauthorizedException
- `483` — ServiceUnavailableException
- `484` — InternalFailureException
- `485` — LimitExceededException
- `486` — ResourceAlreadyExistsException
- `487` — ResourceNotFoundException
- `488` — InvalidQueryException
- `489` — InvalidAggregationException
- `490` — IndexNotReadyException

---

[API](https://skmtc.net/aws/apis/iot.md) · [All operations](https://skmtc.net/aws/apis/iot/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aws/iot/versions/deef5c4b09f0/schema)
