Kinesis Data Streams - Amazon IoT Core
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.

Kinesis Data Streams

The Kinesis Data Streams (kinesis) action writes data from an MQTT message to Amazon Kinesis Data Streams.

Requirements

This rule action has the following requirements:

  • An IAM role that Amazon IoT can assume to perform the kinesis:PutRecord operation. For more information, see Granting Amazon IoT the required access.

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

  • If you use an Amazon Key Management Service (Amazon KMS) customer-managed Amazon KMS key (KMS key) to encrypt data at rest in Kinesis Data Streams, the service must have permission to use the Amazon KMS key on the caller's behalf. For more information, see Permissions to use user-generated Amazon KMS keys in the Amazon Kinesis Data Streams Developer Guide.

Parameters

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

stream

The Kinesis data stream to which to write data.

Supports substitution templates: API and Amazon CLI only

partitionKey

The partition key used to determine to which shard the data is written. The partition key is usually composed of an expression (for example, ${topic()} or ${timestamp()}).

Supports substitution templates: Yes

roleArn

The ARN of the IAM role that grants Amazon IoT permission to access the Kinesis data stream. For more information, see Requirements.

Supports substitution templates: No

Examples

The following JSON example defines a Kinesis Data Streams action in an Amazon IoT rule.

{ "topicRulePayload": { "sql": "SELECT * FROM 'some/topic'", "ruleDisabled": false, "awsIotSqlVersion": "2016-03-23", "actions": [ { "kinesis": { "streamName": "my_kinesis_stream", "partitionKey": "${topic()}", "roleArn": "arn:aws:iam::123456789012:role/aws_iot_kinesis" } } ] } }

The following JSON example defines a Kinesis action with substitution templates in an Amazon IoT rule.

{ "topicRulePayload": { "sql": "SELECT * FROM 'some/topic'", "ruleDisabled": false, "awsIotSqlVersion": "2016-03-23", "actions": [ { "kinesis": { "streamName": "${topic()}", "partitionKey": "${timestamp()}", "roleArn": "arn:aws:iam::123456789012:role/aws_iot_kinesis" } } ] } }

See also