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

Properties for defining an AWS IoT Rule.

Extends: TopicRuleProps
Used as props by: TopicRule

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/topic-rule.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0-alpha.0/packages/@aws-cdk/aws-iot-alpha/lib/topic-rule.ts#L35)

## Example

```ts
import * as sns from 'aws-cdk-lib/aws-sns';

const topic = new sns.Topic(this, 'MyTopic');

const topicRule = new iot.TopicRule(this, 'TopicRule', {
  sql: iot.IotSql.fromStringAsVer20160323(
    "SELECT topic(2) as device_id, year, month, day FROM 'device/+/data'",
  ),
  actions: [
    new actions.SnsTopicAction(topic, {
      messageFormat: actions.SnsActionMessageFormat.JSON, // optional property, default is SnsActionMessageFormat.RAW
    }),
  ],
});
```

## Properties

- `actions`: [IAction](/cdk/api/v2/docs/@aws-cdk_aws-iot-alpha.IAction.html)[] — The actions associated with the topic rule.

  **Default:** No actions will be perform

- `description`: string = None — A textual description of the topic rule.

- `enabled`: boolean = true — Specifies whether the rule is enabled.

- `errorAction`: [IAction](/cdk/api/v2/docs/@aws-cdk_aws-iot-alpha.IAction.html) — The action AWS IoT performs when it is unable to perform a rule's action.

  **Default:** no action will be performed

- `sql`: [IotSql](/cdk/api/v2/docs/@aws-cdk_aws-iot-alpha.IotSql.html) (required) — A simplified SQL syntax to filter messages received on an MQTT topic and push the data elsewhere.

- `topicRuleName`: string = None — The name of the topic rule.
