@aws-cdk_aws-iot-actions-alpha.CloudWatchSetAlarmStateActionProps

interface CloudWatchSetAlarmStateActionProps ๐Ÿ”น

LanguageType name
.NETAmazon.CDK.AWS.IoT.Actions.Alpha.CloudWatchSetAlarmStateActionProps
Gogithub.com/aws/aws-cdk-go/awscdkiotactionsalpha/v2#CloudWatchSetAlarmStateActionProps
Javasoftware.amazon.awscdk.services.iot.actions.alpha.CloudWatchSetAlarmStateActionProps
Pythonaws_cdk.aws_iot_actions_alpha.CloudWatchSetAlarmStateActionProps
TypeScript (source)@aws-cdk/aws-iot-actions-alpha ยป CloudWatchSetAlarmStateActionProps

Configuration properties of an action for CloudWatch alarm.

Example

import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';

const metric = new cloudwatch.Metric({
  namespace: 'MyNamespace',
  metricName: 'MyMetric',
  dimensions: { MyDimension: 'MyDimensionValue' },
});
const alarm = new cloudwatch.Alarm(this, 'MyAlarm', {
  metric: metric,
  threshold: 100,
  evaluationPeriods: 3,
  datapointsToAlarm: 2,
});

const topicRule = new iot.TopicRule(this, 'TopicRule', {
  sql: iot.IotSql.fromStringAsVer20160323("SELECT topic(2) as device_id FROM 'device/+/data'"),
  actions: [
    new actions.CloudWatchSetAlarmStateAction(alarm, {
      reason: 'AWS Iot Rule action is triggered',
      alarmStateToSet: cloudwatch.AlarmState.ALARM,
    }),
  ],
});

Properties

NameTypeDescription
alarmStateToSet๐Ÿ”นAlarmStateThe value of the alarm state to set.
reason?๐Ÿ”นstringThe reason for the alarm change.
role?๐Ÿ”นIRoleThe IAM role that allows access to AWS service.

alarmStateToSet๐Ÿ”น

Type: AlarmState

The value of the alarm state to set.


reason?๐Ÿ”น

Type: string (optional, default: None)

The reason for the alarm change.


role?๐Ÿ”น

Type: IRole (optional, default: a new role will be created)

The IAM role that allows access to AWS service.