Stream
The Stream resource lets you manage AWS Kinesis Streams for real-time data streaming and processing.
Minimal Example
Section titled “Minimal Example”Create a basic Kinesis Stream with a specified number of shards and optional retention period.
import AWS from "alchemy/aws/control";
const kinesisStream = await AWS.Kinesis.Stream("basicKinesisStream", { name: "my-kinesis-stream", shardCount: 2, retentionPeriodHours: 24});
Advanced Configuration
Section titled “Advanced Configuration”Configure a Kinesis Stream with enhanced security settings and stream mode details.
const advancedKinesisStream = await AWS.Kinesis.Stream("advancedKinesisStream", { name: "secure-kinesis-stream", shardCount: 4, retentionPeriodHours: 48, streamModeDetails: { streamMode: "PROVISIONED" }, streamEncryption: { keyId: "alias/my-kms-key", encryptionType: "KMS" }});
Using Tags for Organization
Section titled “Using Tags for Organization”Create a Kinesis Stream with tags for better resource management.
const taggedKinesisStream = await AWS.Kinesis.Stream("taggedKinesisStream", { name: "tagged-kinesis-stream", shardCount: 3, tags: [ { key: "Environment", value: "Production" }, { key: "Project", value: "DataIngestion" } ]});
Adopting Existing Streams
Section titled “Adopting Existing Streams”Adopt an existing Kinesis Stream by setting the adopt
property to true.
const existingKinesisStream = await AWS.Kinesis.Stream("existingKinesisStream", { name: "existing-kinesis-stream", adopt: true // This will not fail if the stream already exists});