Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

IoT Analytics

Focus mode
IoT Analytics - AWS IoT Core

The AWS IoT Analytics (iotAnalytics) action sends data from an MQTT message to an AWS IoT Analytics channel.

Requirements

This rule action has the following requirements:

  • An IAM role that AWS IoT can assume to perform the iotanalytics:BatchPutMessage operation. For more information, see Granting an AWS IoT rule the access it requires.

    In the AWS IoT console, you can choose or create a role to allow AWS IoT to perform this rule action.

    The policy attached to the role you specify should look like the following example.

    { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "iotanalytics:BatchPutMessage", "Resource": [ "arn:aws:iotanalytics:us-west-2:account-id:channel/mychannel" ] } ] }

Parameters

When you create an AWS IoT rule with this action, you must specify the following information:

batchMode

(Optional) 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 AWS IoT Analytics channel. The resulting array can't have more than 100 messages.

Supports substitution templates: No

channelName

The name of the AWS IoT Analytics channel to which to write the data.

Supports substitution templates: API and AWS CLI only

roleArn

The IAM role that allows access to the AWS IoT Analytics channel. For more information, see Requirements.

Supports substitution templates: No

Examples

The following JSON example defines an AWS IoT Analytics action in an AWS IoT rule.

{ "topicRulePayload": { "sql": "SELECT * FROM 'some/topic'", "ruleDisabled": false, "awsIotSqlVersion": "2016-03-23", "actions": [ { "iotAnalytics": { "channelName": "mychannel", "roleArn": "arn:aws:iam::123456789012:role/analyticsRole", } } ] } }

See also

PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.