CloudWatchPutMetricActionProps

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

Bases: CommonActionProps

(experimental) Configuration properties of an action for CloudWatch metric.

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

  • 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.

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}"
        )
    ]
)

Attributes

metric_name

(experimental) The CloudWatch metric name.

Supports substitution templates.

See:

https://docs.aws.amazon.com/iot/latest/developerguide/iot-substitution-templates.html

Stability:

experimental

metric_namespace

(experimental) The CloudWatch metric namespace name.

Supports substitution templates.

See:

https://docs.aws.amazon.com/iot/latest/developerguide/iot-substitution-templates.html

Stability:

experimental

metric_timestamp

(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.

See:

https://docs.aws.amazon.com/iot/latest/developerguide/iot-substitution-templates.html

Stability:

experimental

metric_unit

(experimental) The metric unit supported by CloudWatch.

Supports substitution templates.

See:

https://docs.aws.amazon.com/iot/latest/developerguide/iot-substitution-templates.html

Stability:

experimental

metric_value

(experimental) A string that contains the CloudWatch metric value.

Supports substitution templates.

See:

https://docs.aws.amazon.com/iot/latest/developerguide/iot-substitution-templates.html

Stability:

experimental

role

(experimental) The IAM role that allows access to AWS service.

Default:

a new role will be created

Stability:

experimental