> **Experimental**
>
> `@aws-cdk/aws-iot-actions-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# CloudWatchPutMetricAction

The action to capture an Amazon CloudWatch metric.

Extends: CloudWatchPutMetricAction
Implements: IAction

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/cloudwatch-put-metric-action.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0-alpha.0/packages/@aws-cdk/aws-iot-actions-alpha/lib/cloudwatch-put-metric-action.ts#L56)

## Example

```ts
const topicRule = new iot.TopicRule(this, 'TopicRule', {
  sql: iot.IotSql.fromStringAsVer20160323(
    "SELECT topic(2) as device_id, namespace, unit, value, timestamp FROM 'device/+/data'",
  ),
  actions: [
    new actions.CloudWatchPutMetricAction({
      metricName: '${topic(2)}',
      metricNamespace: '${namespace}',
      metricUnit: '${unit}',
      metricValue: '${value}',
      metricTimestamp: '${timestamp}',
    }),
  ],
});
```

## Initializer

```ts
new CloudWatchPutMetricAction(props: CloudWatchPutMetricActionProps)
```
