Experimental
@aws-cdk/aws-iot-actions-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
CloudWatchSetAlarmStateActionProps Struct
Configuration properties of an action for CloudWatch alarm.
Example
ts
import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';
const metric = new cloudwatch.Metric({
namespace: 'MyNamespace',
metricName: 'MyMetric',
dimensionsMap: { 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
alarmStateToSetAlarmStatealarm_state_to_setAlarmStatealarmStateToSetAlarmStateAlarmStateToSetAlarmStateAlarmStateToSetAlarmStaterequired#The value of the alarm state to set.
reasonoptionalstringreasonoptionalstrreasonoptionalStringReasonoptionalstringReasonoptional*string= None#The reason for the alarm change.