create_topic_rule
(**kwargs)¶Creates a rule. Creating rules is an administrator-level action. Any user who has permission to create rules will be able to access data processed by the rule.
Requires permission to access the CreateTopicRule action.
See also: AWS API Documentation
Request Syntax
response = client.create_topic_rule(
ruleName='string',
topicRulePayload={
'sql': 'string',
'description': 'string',
'actions': [
{
'dynamoDB': {
'tableName': 'string',
'roleArn': 'string',
'operation': 'string',
'hashKeyField': 'string',
'hashKeyValue': 'string',
'hashKeyType': 'STRING'|'NUMBER',
'rangeKeyField': 'string',
'rangeKeyValue': 'string',
'rangeKeyType': 'STRING'|'NUMBER',
'payloadField': 'string'
},
'dynamoDBv2': {
'roleArn': 'string',
'putItem': {
'tableName': 'string'
}
},
'lambda': {
'functionArn': 'string'
},
'sns': {
'targetArn': 'string',
'roleArn': 'string',
'messageFormat': 'RAW'|'JSON'
},
'sqs': {
'roleArn': 'string',
'queueUrl': 'string',
'useBase64': True|False
},
'kinesis': {
'roleArn': 'string',
'streamName': 'string',
'partitionKey': 'string'
},
'republish': {
'roleArn': 'string',
'topic': 'string',
'qos': 123,
'headers': {
'payloadFormatIndicator': 'string',
'contentType': 'string',
'responseTopic': 'string',
'correlationData': 'string',
'messageExpiry': 'string',
'userProperties': [
{
'key': 'string',
'value': 'string'
},
]
}
},
's3': {
'roleArn': 'string',
'bucketName': 'string',
'key': 'string',
'cannedAcl': 'private'|'public-read'|'public-read-write'|'aws-exec-read'|'authenticated-read'|'bucket-owner-read'|'bucket-owner-full-control'|'log-delivery-write'
},
'firehose': {
'roleArn': 'string',
'deliveryStreamName': 'string',
'separator': 'string',
'batchMode': True|False
},
'cloudwatchMetric': {
'roleArn': 'string',
'metricNamespace': 'string',
'metricName': 'string',
'metricValue': 'string',
'metricUnit': 'string',
'metricTimestamp': 'string'
},
'cloudwatchAlarm': {
'roleArn': 'string',
'alarmName': 'string',
'stateReason': 'string',
'stateValue': 'string'
},
'cloudwatchLogs': {
'roleArn': 'string',
'logGroupName': 'string',
'batchMode': True|False
},
'elasticsearch': {
'roleArn': 'string',
'endpoint': 'string',
'index': 'string',
'type': 'string',
'id': 'string'
},
'salesforce': {
'token': 'string',
'url': 'string'
},
'iotAnalytics': {
'channelArn': 'string',
'channelName': 'string',
'batchMode': True|False,
'roleArn': 'string'
},
'iotEvents': {
'inputName': 'string',
'messageId': 'string',
'batchMode': True|False,
'roleArn': 'string'
},
'iotSiteWise': {
'putAssetPropertyValueEntries': [
{
'entryId': 'string',
'assetId': 'string',
'propertyId': 'string',
'propertyAlias': 'string',
'propertyValues': [
{
'value': {
'stringValue': 'string',
'integerValue': 'string',
'doubleValue': 'string',
'booleanValue': 'string'
},
'timestamp': {
'timeInSeconds': 'string',
'offsetInNanos': 'string'
},
'quality': 'string'
},
]
},
],
'roleArn': 'string'
},
'stepFunctions': {
'executionNamePrefix': 'string',
'stateMachineName': 'string',
'roleArn': 'string'
},
'timestream': {
'roleArn': 'string',
'databaseName': 'string',
'tableName': 'string',
'dimensions': [
{
'name': 'string',
'value': 'string'
},
],
'timestamp': {
'value': 'string',
'unit': 'string'
}
},
'http': {
'url': 'string',
'confirmationUrl': 'string',
'headers': [
{
'key': 'string',
'value': 'string'
},
],
'auth': {
'sigv4': {
'signingRegion': 'string',
'serviceName': 'string',
'roleArn': 'string'
}
}
},
'kafka': {
'destinationArn': 'string',
'topic': 'string',
'key': 'string',
'partition': 'string',
'clientProperties': {
'string': 'string'
}
},
'openSearch': {
'roleArn': 'string',
'endpoint': 'string',
'index': 'string',
'type': 'string',
'id': 'string'
},
'location': {
'roleArn': 'string',
'trackerName': 'string',
'deviceId': 'string',
'timestamp': {
'value': 'string',
'unit': 'string'
},
'latitude': 'string',
'longitude': 'string'
}
},
],
'ruleDisabled': True|False,
'awsIotSqlVersion': 'string',
'errorAction': {
'dynamoDB': {
'tableName': 'string',
'roleArn': 'string',
'operation': 'string',
'hashKeyField': 'string',
'hashKeyValue': 'string',
'hashKeyType': 'STRING'|'NUMBER',
'rangeKeyField': 'string',
'rangeKeyValue': 'string',
'rangeKeyType': 'STRING'|'NUMBER',
'payloadField': 'string'
},
'dynamoDBv2': {
'roleArn': 'string',
'putItem': {
'tableName': 'string'
}
},
'lambda': {
'functionArn': 'string'
},
'sns': {
'targetArn': 'string',
'roleArn': 'string',
'messageFormat': 'RAW'|'JSON'
},
'sqs': {
'roleArn': 'string',
'queueUrl': 'string',
'useBase64': True|False
},
'kinesis': {
'roleArn': 'string',
'streamName': 'string',
'partitionKey': 'string'
},
'republish': {
'roleArn': 'string',
'topic': 'string',
'qos': 123,
'headers': {
'payloadFormatIndicator': 'string',
'contentType': 'string',
'responseTopic': 'string',
'correlationData': 'string',
'messageExpiry': 'string',
'userProperties': [
{
'key': 'string',
'value': 'string'
},
]
}
},
's3': {
'roleArn': 'string',
'bucketName': 'string',
'key': 'string',
'cannedAcl': 'private'|'public-read'|'public-read-write'|'aws-exec-read'|'authenticated-read'|'bucket-owner-read'|'bucket-owner-full-control'|'log-delivery-write'
},
'firehose': {
'roleArn': 'string',
'deliveryStreamName': 'string',
'separator': 'string',
'batchMode': True|False
},
'cloudwatchMetric': {
'roleArn': 'string',
'metricNamespace': 'string',
'metricName': 'string',
'metricValue': 'string',
'metricUnit': 'string',
'metricTimestamp': 'string'
},
'cloudwatchAlarm': {
'roleArn': 'string',
'alarmName': 'string',
'stateReason': 'string',
'stateValue': 'string'
},
'cloudwatchLogs': {
'roleArn': 'string',
'logGroupName': 'string',
'batchMode': True|False
},
'elasticsearch': {
'roleArn': 'string',
'endpoint': 'string',
'index': 'string',
'type': 'string',
'id': 'string'
},
'salesforce': {
'token': 'string',
'url': 'string'
},
'iotAnalytics': {
'channelArn': 'string',
'channelName': 'string',
'batchMode': True|False,
'roleArn': 'string'
},
'iotEvents': {
'inputName': 'string',
'messageId': 'string',
'batchMode': True|False,
'roleArn': 'string'
},
'iotSiteWise': {
'putAssetPropertyValueEntries': [
{
'entryId': 'string',
'assetId': 'string',
'propertyId': 'string',
'propertyAlias': 'string',
'propertyValues': [
{
'value': {
'stringValue': 'string',
'integerValue': 'string',
'doubleValue': 'string',
'booleanValue': 'string'
},
'timestamp': {
'timeInSeconds': 'string',
'offsetInNanos': 'string'
},
'quality': 'string'
},
]
},
],
'roleArn': 'string'
},
'stepFunctions': {
'executionNamePrefix': 'string',
'stateMachineName': 'string',
'roleArn': 'string'
},
'timestream': {
'roleArn': 'string',
'databaseName': 'string',
'tableName': 'string',
'dimensions': [
{
'name': 'string',
'value': 'string'
},
],
'timestamp': {
'value': 'string',
'unit': 'string'
}
},
'http': {
'url': 'string',
'confirmationUrl': 'string',
'headers': [
{
'key': 'string',
'value': 'string'
},
],
'auth': {
'sigv4': {
'signingRegion': 'string',
'serviceName': 'string',
'roleArn': 'string'
}
}
},
'kafka': {
'destinationArn': 'string',
'topic': 'string',
'key': 'string',
'partition': 'string',
'clientProperties': {
'string': 'string'
}
},
'openSearch': {
'roleArn': 'string',
'endpoint': 'string',
'index': 'string',
'type': 'string',
'id': 'string'
},
'location': {
'roleArn': 'string',
'trackerName': 'string',
'deviceId': 'string',
'timestamp': {
'value': 'string',
'unit': 'string'
},
'latitude': 'string',
'longitude': 'string'
}
}
},
tags='string'
)
[REQUIRED]
The name of the rule.
[REQUIRED]
The rule payload.
The SQL statement used to query the topic. For more information, see IoT SQL Reference in the IoT Developer Guide .
The description of the rule.
The actions associated with the rule.
Describes the actions associated with a rule.
Write to a DynamoDB table.
The name of the DynamoDB table.
The ARN of the IAM role that grants access to the DynamoDB table.
The type of operation to be performed. This follows the substitution template, so it can be ${operation}
, but the substitution must result in one of the following: INSERT
, UPDATE
, or DELETE
.
The hash key name.
The hash key value.
The hash key type. Valid values are "STRING" or "NUMBER"
The range key name.
The range key value.
The range key type. Valid values are "STRING" or "NUMBER"
The action payload. This name can be customized.
Write to a DynamoDB table. This is a new version of the DynamoDB action. It allows you to write each attribute in an MQTT message payload into a separate DynamoDB column.
The ARN of the IAM role that grants access to the DynamoDB table.
Specifies the DynamoDB table to which the message data will be written. For example:
{ "dynamoDBv2": { "roleArn": "aws:iam:12341251:my-role" "putItem": { "tableName": "my-table" } } }
Each attribute in the message payload will be written to a separate column in the DynamoDB database.
The table where the message data will be written.
Invoke a Lambda function.
The ARN of the Lambda function.
Publish to an Amazon SNS topic.
The ARN of the SNS topic.
The ARN of the IAM role that grants access.
(Optional) The message format of the message to publish. Accepted values are "JSON" and "RAW". The default value of the attribute is "RAW". SNS uses this setting to determine if the payload should be parsed and relevant platform-specific bits of the payload should be extracted. To read more about SNS message formats, see https://docs.aws.amazon.com/sns/latest/dg/json-formats.html refer to their official documentation.
Publish to an Amazon SQS queue.
The ARN of the IAM role that grants access.
The URL of the Amazon SQS queue.
Specifies whether to use Base64 encoding.
Write data to an Amazon Kinesis stream.
The ARN of the IAM role that grants access to the Amazon Kinesis stream.
The name of the Amazon Kinesis stream.
The partition key.
Publish to another MQTT topic.
The ARN of the IAM role that grants access.
The name of the MQTT topic.
The Quality of Service (QoS) level to use when republishing messages. The default value is 0.
MQTT Version 5.0 headers information. For more information, see MQTT from the Amazon Web Services IoT Core Developer Guide.
An Enum
string value that indicates whether the payload is formatted as UTF-8.
Valid values are UNSPECIFIED_BYTES
and UTF8_DATA
.
For more information, see Payload Format Indicator from the MQTT Version 5.0 specification.
Supports substitution templates.
A UTF-8 encoded string that describes the content of the publishing message.
For more information, see Content Type from the MQTT Version 5.0 specification.
Supports substitution templates.
A UTF-8 encoded string that's used as the topic name for a response message. The response topic is used to describe the topic which the receiver should publish to as part of the request-response flow. The topic must not contain wildcard characters.
For more information, see Response Topic from the MQTT Version 5.0 specification.
Supports substitution templates.
The base64-encoded binary data used by the sender of the request message to identify which request the response message is for when it's received.
For more information, see Correlation Data from the MQTT Version 5.0 specification.
Note
This binary data must be based64-encoded.
Supports substitution templates.
A user-defined integer value that will persist a message at the message broker for a specified amount of time to ensure that the message will expire if it's no longer relevant to the subscriber. The value of messageExpiry
represents the number of seconds before it expires. For more information about the limits of messageExpiry
, see Amazon Web Services IoT Core message broker and protocol limits and quotas from the Amazon Web Services Reference Guide.
Supports substitution templates.
An array of key-value pairs that you define in the MQTT5 header.
A key-value pair that you define in the header. Both the key and the value are either literal strings or valid substitution templates.
A key to be specified in UserProperty
.
A value to be specified in UserProperty
.
Write to an Amazon S3 bucket.
The ARN of the IAM role that grants access.
The Amazon S3 bucket.
The object key. For more information, see Actions, resources, and condition keys for Amazon S3.
The Amazon S3 canned ACL that controls access to the object identified by the object key. For more information, see S3 canned ACLs.
Write to an Amazon Kinesis Firehose stream.
The IAM role that grants access to the Amazon Kinesis Firehose stream.
The delivery stream name.
A character separator that will be used to separate records written to the Firehose stream. Valid values are: 'n' (newline), 't' (tab), 'rn' (Windows newline), ',' (comma).
Whether to deliver the Kinesis Data Firehose stream as a batch by using PutRecordBatch. The default value is false
.
When batchMode
is true
and the rule's SQL statement evaluates to an Array, each Array element forms one record in the PutRecordBatch request. The resulting array can't have more than 500 records.
Capture a CloudWatch metric.
The IAM role that allows access to the CloudWatch metric.
The CloudWatch metric namespace name.
The CloudWatch metric name.
The CloudWatch metric value.
The metric unit supported by CloudWatch.
An optional Unix timestamp.
Change the state of a CloudWatch alarm.
The IAM role that allows access to the CloudWatch alarm.
The CloudWatch alarm name.
The reason for the alarm change.
The value of the alarm state. Acceptable values are: OK, ALARM, INSUFFICIENT_DATA.
Send data to CloudWatch Logs.
The IAM role that allows access to the CloudWatch log.
The CloudWatch log group to which the action sends data.
Indicates whether batches of log records will be extracted and uploaded into CloudWatch. Values include true
or false
(default) .
Write data to an Amazon OpenSearch Service domain.
Note
The Elasticsearch
action can only be used by existing rule actions. To create a new rule action or to update an existing rule action, use the OpenSearch
rule action instead. For more information, see OpenSearchAction.
The IAM role ARN that has access to OpenSearch.
The endpoint of your OpenSearch domain.
The index where you want to store your data.
The type of document you are storing.
The unique identifier for the document you are storing.
Send a message to a Salesforce IoT Cloud Input Stream.
The token used to authenticate access to the Salesforce IoT Cloud Input Stream. The token is available from the Salesforce IoT Cloud platform after creation of the Input Stream.
The URL exposed by the Salesforce IoT Cloud Input Stream. The URL is available from the Salesforce IoT Cloud platform after creation of the Input Stream.
Sends message data to an IoT Analytics channel.
(deprecated) The ARN of the IoT Analytics channel to which message data will be sent.
The name of the IoT Analytics channel to which message data will be sent.
Whether to process the action as a batch. The default value is false
.
When batchMode
is true
and the rule SQL statement evaluates to an Array, each Array element is delivered as a separate message when passed by BatchPutMessage to the IoT Analytics channel. The resulting array can't have more than 100 messages.
The ARN of the role which has a policy that grants IoT Analytics permission to send message data via IoT Analytics (iotanalytics:BatchPutMessage).
Sends an input to an IoT Events detector.
The name of the IoT Events input.
The ID of the message. The default messageId
is a new UUID value.
When batchMode
is true
, you can't specify a messageId
--a new UUID value will be assigned.
Assign a value to this property to ensure that only one input (message) with a given messageId
will be processed by an IoT Events detector.
Whether to process the event actions as a batch. The default value is false
.
When batchMode
is true
, you can't specify a messageId
.
When batchMode
is true
and the rule SQL statement evaluates to an Array, each Array element is treated as a separate message when it's sent to IoT Events by calling BatchPutMessage. The resulting array can't have more than 10 messages.
The ARN of the role that grants IoT permission to send an input to an IoT Events detector. ("Action":"iotevents:BatchPutMessage").
Sends data from the MQTT message that triggered the rule to IoT SiteWise asset properties.
A list of asset property value entries.
An asset property value entry containing the following information.
Optional. A unique identifier for this entry that you can define to better track which message caused an error in case of failure. Accepts substitution templates. Defaults to a new UUID.
The ID of the IoT SiteWise asset. You must specify either a propertyAlias
or both an aliasId
and a propertyId
. Accepts substitution templates.
The ID of the asset's property. You must specify either a propertyAlias
or both an aliasId
and a propertyId
. Accepts substitution templates.
The name of the property alias associated with your asset property. You must specify either a propertyAlias
or both an aliasId
and a propertyId
. Accepts substitution templates.
A list of property values to insert that each contain timestamp, quality, and value (TQV) information.
An asset property value entry containing the following information.
The value of the asset property.
Optional. The string value of the value entry. Accepts substitution templates.
Optional. A string that contains the integer value of the value entry. Accepts substitution templates.
Optional. A string that contains the double value of the value entry. Accepts substitution templates.
Optional. A string that contains the boolean value ( true
or false
) of the value entry. Accepts substitution templates.
The asset property value timestamp.
A string that contains the time in seconds since epoch. Accepts substitution templates.
Optional. A string that contains the nanosecond time offset. Accepts substitution templates.
Optional. A string that describes the quality of the value. Accepts substitution templates. Must be GOOD
, BAD
, or UNCERTAIN
.
The ARN of the role that grants IoT permission to send an asset property value to IoT SiteWise. ( "Action": "iotsitewise:BatchPutAssetPropertyValue"
). The trust policy can restrict access to specific asset hierarchy paths.
Starts execution of a Step Functions state machine.
(Optional) A name will be given to the state machine execution consisting of this prefix followed by a UUID. Step Functions automatically creates a unique name for each state machine execution if one is not provided.
The name of the Step Functions state machine whose execution will be started.
The ARN of the role that grants IoT permission to start execution of a state machine ("Action":"states:StartExecution").
The Timestream rule action writes attributes (measures) from an MQTT message into an Amazon Timestream table. For more information, see the Timestream topic rule action documentation.
The ARN of the role that grants permission to write to the Amazon Timestream database table.
The name of an Amazon Timestream database.
The name of the database table into which to write the measure records.
Metadata attributes of the time series that are written in each measure record.
Metadata attributes of the time series that are written in each measure record.
The metadata dimension name. This is the name of the column in the Amazon Timestream database table record.
Dimensions cannot be named: measure_name
, measure_value
, or time
. These names are reserved. Dimension names cannot start with ts_
or measure_value
and they cannot contain the colon ( :
) character.
The value to write in this column of the database record.
Specifies an application-defined value to replace the default value assigned to the Timestream record's timestamp in the time
column.
You can use this property to specify the value and the precision of the Timestream record's timestamp. You can specify a value from the message payload or a value computed by a substitution template.
If omitted, the topic rule action assigns the timestamp, in milliseconds, at the time it processed the rule.
An expression that returns a long epoch time value.
The precision of the timestamp value that results from the expression described in value
.
Valid values: SECONDS
| MILLISECONDS
| MICROSECONDS
| NANOSECONDS
. The default is MILLISECONDS
.
Send data to an HTTPS endpoint.
The endpoint URL. If substitution templates are used in the URL, you must also specify a confirmationUrl
. If this is a new destination, a new TopicRuleDestination
is created if possible.
The URL to which IoT sends a confirmation message. The value of the confirmation URL must be a prefix of the endpoint URL. If you do not specify a confirmation URL IoT uses the endpoint URL as the confirmation URL. If you use substitution templates in the confirmationUrl, you must create and enable topic rule destinations that match each possible value of the substitution template before traffic is allowed to your endpoint URL.
The HTTP headers to send with the message data.
The HTTP action header.
The HTTP header key.
The HTTP header value. Substitution templates are supported.
The authentication method to use when sending data to an HTTPS endpoint.
Use Sig V4 authorization. For more information, see Signature Version 4 Signing Process.
The signing region.
The service name to use while signing with Sig V4.
The ARN of the signing role.
Send messages to an Amazon Managed Streaming for Apache Kafka (Amazon MSK) or self-managed Apache Kafka cluster.
The ARN of Kafka action's VPC TopicRuleDestination
.
The Kafka topic for messages to be sent to the Kafka broker.
The Kafka message key.
The Kafka message partition.
Properties of the Apache Kafka producer client.
Write data to an Amazon OpenSearch Service domain.
The IAM role ARN that has access to OpenSearch.
The endpoint of your OpenSearch domain.
The OpenSearch index where you want to store your data.
The type of document you are storing.
The unique identifier for the document you are storing.
The Amazon Location Service rule action sends device location updates from an MQTT message to an Amazon Location tracker resource.
The IAM role that grants permission to write to the Amazon Location resource.
The name of the tracker resource in Amazon Location in which the location is updated.
The unique ID of the device providing the location data.
The time that the location data was sampled. The default value is the time the MQTT message was processed.
An expression that returns a long epoch time value.
The precision of the timestamp value that results from the expression described in value
.
Valid values: SECONDS
| MILLISECONDS
| MICROSECONDS
| NANOSECONDS
. The default is MILLISECONDS
.
A string that evaluates to a double value that represents the latitude of the device's location.
A string that evaluates to a double value that represents the longitude of the device's location.
Specifies whether the rule is disabled.
The version of the SQL rules engine to use when evaluating the rule.
The action to take when an error occurs.
Write to a DynamoDB table.
The name of the DynamoDB table.
The ARN of the IAM role that grants access to the DynamoDB table.
The type of operation to be performed. This follows the substitution template, so it can be ${operation}
, but the substitution must result in one of the following: INSERT
, UPDATE
, or DELETE
.
The hash key name.
The hash key value.
The hash key type. Valid values are "STRING" or "NUMBER"
The range key name.
The range key value.
The range key type. Valid values are "STRING" or "NUMBER"
The action payload. This name can be customized.
Write to a DynamoDB table. This is a new version of the DynamoDB action. It allows you to write each attribute in an MQTT message payload into a separate DynamoDB column.
The ARN of the IAM role that grants access to the DynamoDB table.
Specifies the DynamoDB table to which the message data will be written. For example:
{ "dynamoDBv2": { "roleArn": "aws:iam:12341251:my-role" "putItem": { "tableName": "my-table" } } }
Each attribute in the message payload will be written to a separate column in the DynamoDB database.
The table where the message data will be written.
Invoke a Lambda function.
The ARN of the Lambda function.
Publish to an Amazon SNS topic.
The ARN of the SNS topic.
The ARN of the IAM role that grants access.
(Optional) The message format of the message to publish. Accepted values are "JSON" and "RAW". The default value of the attribute is "RAW". SNS uses this setting to determine if the payload should be parsed and relevant platform-specific bits of the payload should be extracted. To read more about SNS message formats, see https://docs.aws.amazon.com/sns/latest/dg/json-formats.html refer to their official documentation.
Publish to an Amazon SQS queue.
The ARN of the IAM role that grants access.
The URL of the Amazon SQS queue.
Specifies whether to use Base64 encoding.
Write data to an Amazon Kinesis stream.
The ARN of the IAM role that grants access to the Amazon Kinesis stream.
The name of the Amazon Kinesis stream.
The partition key.
Publish to another MQTT topic.
The ARN of the IAM role that grants access.
The name of the MQTT topic.
The Quality of Service (QoS) level to use when republishing messages. The default value is 0.
MQTT Version 5.0 headers information. For more information, see MQTT from the Amazon Web Services IoT Core Developer Guide.
An Enum
string value that indicates whether the payload is formatted as UTF-8.
Valid values are UNSPECIFIED_BYTES
and UTF8_DATA
.
For more information, see Payload Format Indicator from the MQTT Version 5.0 specification.
Supports substitution templates.
A UTF-8 encoded string that describes the content of the publishing message.
For more information, see Content Type from the MQTT Version 5.0 specification.
Supports substitution templates.
A UTF-8 encoded string that's used as the topic name for a response message. The response topic is used to describe the topic which the receiver should publish to as part of the request-response flow. The topic must not contain wildcard characters.
For more information, see Response Topic from the MQTT Version 5.0 specification.
Supports substitution templates.
The base64-encoded binary data used by the sender of the request message to identify which request the response message is for when it's received.
For more information, see Correlation Data from the MQTT Version 5.0 specification.
Note
This binary data must be based64-encoded.
Supports substitution templates.
A user-defined integer value that will persist a message at the message broker for a specified amount of time to ensure that the message will expire if it's no longer relevant to the subscriber. The value of messageExpiry
represents the number of seconds before it expires. For more information about the limits of messageExpiry
, see Amazon Web Services IoT Core message broker and protocol limits and quotas from the Amazon Web Services Reference Guide.
Supports substitution templates.
An array of key-value pairs that you define in the MQTT5 header.
A key-value pair that you define in the header. Both the key and the value are either literal strings or valid substitution templates.
A key to be specified in UserProperty
.
A value to be specified in UserProperty
.
Write to an Amazon S3 bucket.
The ARN of the IAM role that grants access.
The Amazon S3 bucket.
The object key. For more information, see Actions, resources, and condition keys for Amazon S3.
The Amazon S3 canned ACL that controls access to the object identified by the object key. For more information, see S3 canned ACLs.
Write to an Amazon Kinesis Firehose stream.
The IAM role that grants access to the Amazon Kinesis Firehose stream.
The delivery stream name.
A character separator that will be used to separate records written to the Firehose stream. Valid values are: 'n' (newline), 't' (tab), 'rn' (Windows newline), ',' (comma).
Whether to deliver the Kinesis Data Firehose stream as a batch by using PutRecordBatch. The default value is false
.
When batchMode
is true
and the rule's SQL statement evaluates to an Array, each Array element forms one record in the PutRecordBatch request. The resulting array can't have more than 500 records.
Capture a CloudWatch metric.
The IAM role that allows access to the CloudWatch metric.
The CloudWatch metric namespace name.
The CloudWatch metric name.
The CloudWatch metric value.
The metric unit supported by CloudWatch.
An optional Unix timestamp.
Change the state of a CloudWatch alarm.
The IAM role that allows access to the CloudWatch alarm.
The CloudWatch alarm name.
The reason for the alarm change.
The value of the alarm state. Acceptable values are: OK, ALARM, INSUFFICIENT_DATA.
Send data to CloudWatch Logs.
The IAM role that allows access to the CloudWatch log.
The CloudWatch log group to which the action sends data.
Indicates whether batches of log records will be extracted and uploaded into CloudWatch. Values include true
or false
(default) .
Write data to an Amazon OpenSearch Service domain.
Note
The Elasticsearch
action can only be used by existing rule actions. To create a new rule action or to update an existing rule action, use the OpenSearch
rule action instead. For more information, see OpenSearchAction.
The IAM role ARN that has access to OpenSearch.
The endpoint of your OpenSearch domain.
The index where you want to store your data.
The type of document you are storing.
The unique identifier for the document you are storing.
Send a message to a Salesforce IoT Cloud Input Stream.
The token used to authenticate access to the Salesforce IoT Cloud Input Stream. The token is available from the Salesforce IoT Cloud platform after creation of the Input Stream.
The URL exposed by the Salesforce IoT Cloud Input Stream. The URL is available from the Salesforce IoT Cloud platform after creation of the Input Stream.
Sends message data to an IoT Analytics channel.
(deprecated) The ARN of the IoT Analytics channel to which message data will be sent.
The name of the IoT Analytics channel to which message data will be sent.
Whether to process the action as a batch. The default value is false
.
When batchMode
is true
and the rule SQL statement evaluates to an Array, each Array element is delivered as a separate message when passed by BatchPutMessage to the IoT Analytics channel. The resulting array can't have more than 100 messages.
The ARN of the role which has a policy that grants IoT Analytics permission to send message data via IoT Analytics (iotanalytics:BatchPutMessage).
Sends an input to an IoT Events detector.
The name of the IoT Events input.
The ID of the message. The default messageId
is a new UUID value.
When batchMode
is true
, you can't specify a messageId
--a new UUID value will be assigned.
Assign a value to this property to ensure that only one input (message) with a given messageId
will be processed by an IoT Events detector.
Whether to process the event actions as a batch. The default value is false
.
When batchMode
is true
, you can't specify a messageId
.
When batchMode
is true
and the rule SQL statement evaluates to an Array, each Array element is treated as a separate message when it's sent to IoT Events by calling BatchPutMessage. The resulting array can't have more than 10 messages.
The ARN of the role that grants IoT permission to send an input to an IoT Events detector. ("Action":"iotevents:BatchPutMessage").
Sends data from the MQTT message that triggered the rule to IoT SiteWise asset properties.
A list of asset property value entries.
An asset property value entry containing the following information.
Optional. A unique identifier for this entry that you can define to better track which message caused an error in case of failure. Accepts substitution templates. Defaults to a new UUID.
The ID of the IoT SiteWise asset. You must specify either a propertyAlias
or both an aliasId
and a propertyId
. Accepts substitution templates.
The ID of the asset's property. You must specify either a propertyAlias
or both an aliasId
and a propertyId
. Accepts substitution templates.
The name of the property alias associated with your asset property. You must specify either a propertyAlias
or both an aliasId
and a propertyId
. Accepts substitution templates.
A list of property values to insert that each contain timestamp, quality, and value (TQV) information.
An asset property value entry containing the following information.
The value of the asset property.
Optional. The string value of the value entry. Accepts substitution templates.
Optional. A string that contains the integer value of the value entry. Accepts substitution templates.
Optional. A string that contains the double value of the value entry. Accepts substitution templates.
Optional. A string that contains the boolean value ( true
or false
) of the value entry. Accepts substitution templates.
The asset property value timestamp.
A string that contains the time in seconds since epoch. Accepts substitution templates.
Optional. A string that contains the nanosecond time offset. Accepts substitution templates.
Optional. A string that describes the quality of the value. Accepts substitution templates. Must be GOOD
, BAD
, or UNCERTAIN
.
The ARN of the role that grants IoT permission to send an asset property value to IoT SiteWise. ( "Action": "iotsitewise:BatchPutAssetPropertyValue"
). The trust policy can restrict access to specific asset hierarchy paths.
Starts execution of a Step Functions state machine.
(Optional) A name will be given to the state machine execution consisting of this prefix followed by a UUID. Step Functions automatically creates a unique name for each state machine execution if one is not provided.
The name of the Step Functions state machine whose execution will be started.
The ARN of the role that grants IoT permission to start execution of a state machine ("Action":"states:StartExecution").
The Timestream rule action writes attributes (measures) from an MQTT message into an Amazon Timestream table. For more information, see the Timestream topic rule action documentation.
The ARN of the role that grants permission to write to the Amazon Timestream database table.
The name of an Amazon Timestream database.
The name of the database table into which to write the measure records.
Metadata attributes of the time series that are written in each measure record.
Metadata attributes of the time series that are written in each measure record.
The metadata dimension name. This is the name of the column in the Amazon Timestream database table record.
Dimensions cannot be named: measure_name
, measure_value
, or time
. These names are reserved. Dimension names cannot start with ts_
or measure_value
and they cannot contain the colon ( :
) character.
The value to write in this column of the database record.
Specifies an application-defined value to replace the default value assigned to the Timestream record's timestamp in the time
column.
You can use this property to specify the value and the precision of the Timestream record's timestamp. You can specify a value from the message payload or a value computed by a substitution template.
If omitted, the topic rule action assigns the timestamp, in milliseconds, at the time it processed the rule.
An expression that returns a long epoch time value.
The precision of the timestamp value that results from the expression described in value
.
Valid values: SECONDS
| MILLISECONDS
| MICROSECONDS
| NANOSECONDS
. The default is MILLISECONDS
.
Send data to an HTTPS endpoint.
The endpoint URL. If substitution templates are used in the URL, you must also specify a confirmationUrl
. If this is a new destination, a new TopicRuleDestination
is created if possible.
The URL to which IoT sends a confirmation message. The value of the confirmation URL must be a prefix of the endpoint URL. If you do not specify a confirmation URL IoT uses the endpoint URL as the confirmation URL. If you use substitution templates in the confirmationUrl, you must create and enable topic rule destinations that match each possible value of the substitution template before traffic is allowed to your endpoint URL.
The HTTP headers to send with the message data.
The HTTP action header.
The HTTP header key.
The HTTP header value. Substitution templates are supported.
The authentication method to use when sending data to an HTTPS endpoint.
Use Sig V4 authorization. For more information, see Signature Version 4 Signing Process.
The signing region.
The service name to use while signing with Sig V4.
The ARN of the signing role.
Send messages to an Amazon Managed Streaming for Apache Kafka (Amazon MSK) or self-managed Apache Kafka cluster.
The ARN of Kafka action's VPC TopicRuleDestination
.
The Kafka topic for messages to be sent to the Kafka broker.
The Kafka message key.
The Kafka message partition.
Properties of the Apache Kafka producer client.
Write data to an Amazon OpenSearch Service domain.
The IAM role ARN that has access to OpenSearch.
The endpoint of your OpenSearch domain.
The OpenSearch index where you want to store your data.
The type of document you are storing.
The unique identifier for the document you are storing.
The Amazon Location Service rule action sends device location updates from an MQTT message to an Amazon Location tracker resource.
The IAM role that grants permission to write to the Amazon Location resource.
The name of the tracker resource in Amazon Location in which the location is updated.
The unique ID of the device providing the location data.
The time that the location data was sampled. The default value is the time the MQTT message was processed.
An expression that returns a long epoch time value.
The precision of the timestamp value that results from the expression described in value
.
Valid values: SECONDS
| MILLISECONDS
| MICROSECONDS
| NANOSECONDS
. The default is MILLISECONDS
.
A string that evaluates to a double value that represents the latitude of the device's location.
A string that evaluates to a double value that represents the longitude of the device's location.
Metadata which can be used to manage the topic rule.
Note
For URI Request parameters use format: ...key1=value1&key2=value2...
For the CLI command-line parameter use format: --tags "key1=value1&key2=value2..."
For the cli-input-json file use format: "tags": "key1=value1&key2=value2..."
None
Exceptions
IoT.Client.exceptions.SqlParseException
IoT.Client.exceptions.InternalException
IoT.Client.exceptions.InvalidRequestException
IoT.Client.exceptions.ResourceAlreadyExistsException
IoT.Client.exceptions.ServiceUnavailableException
IoT.Client.exceptions.ConflictingResourceUpdateException