> **Experimental**
>
> `@aws-cdk/aws-iot-actions-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# CloudWatchSetAlarmStateActionProps

Configuration properties of an action for CloudWatch alarm.

Extends: CloudWatchSetAlarmStateActionProps
Extends: CommonActionProps
Used as props by: CloudWatchSetAlarmStateAction

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/cloudwatch-set-alarm-state-action.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0-alpha.0/packages/@aws-cdk/aws-iot-actions-alpha/lib/cloudwatch-set-alarm-state-action.ts#L10)

## 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

- `alarmStateToSet`: [AlarmState](/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch.AlarmState.html) (required) — The value of the alarm state to set.

- `reason`: string = None — The reason for the alarm change.

- `role`: [IRole](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IRole.html) — The IAM role that allows access to AWS service.

  **Default:** a new role will be created
