CloudWatchPutMetricAction

class aws_cdk.aws_iot_actions_alpha.CloudWatchPutMetricAction(*, metric_name, metric_namespace, metric_unit, metric_value, metric_timestamp=None, role=None)

Bases: object

(experimental) The action to capture an Amazon CloudWatch metric.

Stability:

experimental

ExampleMetadata:

infused

Example:

topic_rule = iot.TopicRule(self, "TopicRule",
    sql=iot.IotSql.from_string_as_ver20160323("SELECT topic(2) as device_id, namespace, unit, value, timestamp FROM 'device/+/data'"),
    actions=[
        actions.CloudWatchPutMetricAction(
            metric_name="${topic(2)}",
            metric_namespace="${namespace}",
            metric_unit="${unit}",
            metric_value="${value}",
            metric_timestamp="${timestamp}"
        )
    ]
)
Parameters:
  • metric_name (str) – (experimental) The CloudWatch metric name. Supports substitution templates.

  • metric_namespace (str) – (experimental) The CloudWatch metric namespace name. Supports substitution templates.

  • metric_unit (str) – (experimental) The metric unit supported by CloudWatch. Supports substitution templates.

  • metric_value (str) – (experimental) A string that contains the CloudWatch metric value. Supports substitution templates.

  • metric_timestamp (Optional[str]) – (experimental) A string that contains the timestamp, expressed in seconds in Unix epoch time. Supports substitution templates. Default: - none – Defaults to the current Unix epoch time.

  • role (Optional[IRole]) – (experimental) The IAM role that allows access to AWS service. Default: a new role will be created

Stability:

experimental