Skip to content
v2.273.0

Experimental

@aws-cdk/aws-iot-actions-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

CloudWatchPutMetricActionProps Struct ​

Configuration properties of an action for CloudWatch metric.

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}',
    }),
  ],
});

Properties ​

metricNamestringmetric_namestrmetricNameStringMetricNamestringMetricName*stringrequired#
The CloudWatch metric name.

Supports substitution templates.

metricNamespacestringmetric_namespacestrmetricNamespaceStringMetricNamespacestringMetricNamespace*stringrequired#
The CloudWatch metric namespace name.

Supports substitution templates.

metricTimestampstringmetric_timestampstrmetricTimestampStringMetricTimestampstringMetricTimestamp*string= none -- Defaults to the current …#
A string that contains the timestamp, expressed in seconds in Unix epoch time.

Supports substitution templates.

default

Default: none -- Defaults to the current Unix epoch time.

metricUnitstringmetric_unitstrmetricUnitStringMetricUnitstringMetricUnit*stringrequired#
The metric unit supported by CloudWatch.

Supports substitution templates.

metricValuestringmetric_valuestrmetricValueStringMetricValuestringMetricValue*stringrequired#
A string that contains the CloudWatch metric value.

Supports substitution templates.

roleIRoleroleIRoleroleIRoleRoleIRoleRoleIRole= a new role will be created#
The IAM role that allows access to AWS service.

Used as props by ​