Experimental
@aws-cdk/aws-iot-actions-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
FirehosePutRecordActionProps Struct
Configuration properties of an action for the Amazon Data Firehose stream.
| Stability | Experimental |
|---|---|
| Source | lib/firehose-put-record-action.ts |
Example
ts
import * as firehose from 'aws-cdk-lib/aws-kinesisfirehose';
const bucket = new s3.Bucket(this, 'MyBucket');
const stream = new firehose.DeliveryStream(this, 'MyStream', {
destination: new firehose.S3Bucket(bucket),
});
const topicRule = new iot.TopicRule(this, 'TopicRule', {
sql: iot.IotSql.fromStringAsVer20160323("SELECT * FROM 'device/+/data'"),
actions: [
new actions.FirehosePutRecordAction(stream, {
batchMode: true,
recordSeparator: actions.FirehoseRecordSeparator.NEWLINE,
}),
],
});
python
import aws_cdk.aws_kinesisfirehose as firehose
bucket = s3.Bucket(self, "MyBucket")
stream = firehose.DeliveryStream(self, "MyStream",
destination=firehose.S3Bucket(bucket)
)
topic_rule = iot.TopicRule(self, "TopicRule",
sql=iot.IotSql.from_string_as_ver20160323("SELECT * FROM 'device/+/data'"),
actions=[
actions.FirehosePutRecordAction(stream,
batch_mode=True,
record_separator=actions.FirehoseRecordSeparator.NEWLINE
)
]
)
java
import software.amazon.awscdk.services.kinesisfirehose.*;
Bucket bucket = new Bucket(this, "MyBucket");
DeliveryStream stream = DeliveryStream.Builder.create(this, "MyStream")
.destination(new S3Bucket(bucket))
.build();
TopicRule topicRule = TopicRule.Builder.create(this, "TopicRule")
.sql(IotSql.fromStringAsVer20160323("SELECT * FROM 'device/+/data'"))
.actions(List.of(
FirehosePutRecordAction.Builder.create(stream)
.batchMode(true)
.recordSeparator(FirehoseRecordSeparator.NEWLINE)
.build()))
.build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.IoT.Actions.Alpha
using Amazon.CDK.AWS.KinesisFirehose;
var bucket = new Bucket(this, "MyBucket");
var stream = new DeliveryStream(this, "MyStream", new DeliveryStreamProps {
Destination = new S3Bucket(bucket)
});
var topicRule = new TopicRule(this, "TopicRule", new TopicRuleProps {
Sql = IotSql.FromStringAsVer20160323("SELECT * FROM 'device/+/data'"),
Actions = new [] {
new FirehosePutRecordAction(stream, new FirehosePutRecordActionProps {
BatchMode = true,
RecordSeparator = FirehoseRecordSeparator.NEWLINE
}) }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdkiotactionsalpha/v2
import "github.com/aws/aws-cdk-go/awscdk"
bucket := s3.NewBucket(this, jsii.String("MyBucket"))
stream := firehose.NewDeliveryStream(this, jsii.String("MyStream"), &DeliveryStreamProps{
Destination: firehose.NewS3Bucket(bucket),
})
topicRule := iot.NewTopicRule(this, jsii.String("TopicRule"), &TopicRuleProps{
Sql: iot.IotSql_FromStringAsVer20160323(jsii.String("SELECT * FROM 'device/+/data'")),
Actions: []IAction{
actions.NewFirehosePutRecordAction(stream, &FirehosePutRecordActionProps{
BatchMode: jsii.Boolean(true),
RecordSeparator: actions.FirehoseRecordSeparator_NEWLINE,
}),
},
})
Properties
batchModeoptionalbooleanbatch_modeoptionalboolbatchModeoptionalBooleanBatchModeoptionalboolBatchModeoptional*bool = false #Whether to deliver the Amazon Data Firehose stream as a batch by using `PutRecordBatch`.
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.
recordSeparatoroptionalFirehoseRecordSeparatorrecord_separatoroptionalFirehoseRecordSeparatorrecordSeparatoroptionalFirehoseRecordSeparatorRecordSeparatoroptionalFirehoseRecordSeparatorRecordSeparatoroptionalFirehoseRecordSeparator #A character separator that will be used to separate records written to the Amazon Data Firehose stream.
Default: none -- the stream does not use a separator