# StreamProps

Properties for a Kinesis Stream.

Used as props by: [Stream](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kinesis.Stream.html)

- Source: [`aws-kinesis/lib/stream.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-kinesis/lib/stream.ts#L796)
- Type last changed: v2.220.0 · 14 Oct 2025

## Example

TypeScript:

```ts
const key = new kms.Key(this, 'MyKey');

new kinesis.Stream(this, 'MyEncryptedStream', {
  encryption: kinesis.StreamEncryption.KMS,
  encryptionKey: key,
});
```

Python:

```python
key = kms.Key(self, "MyKey")

kinesis.Stream(self, "MyEncryptedStream",
    encryption=kinesis.StreamEncryption.KMS,
    encryption_key=key
)
```

Java:

```java
Key key = new Key(this, "MyKey");

Stream.Builder.create(this, "MyEncryptedStream")
        .encryption(StreamEncryption.KMS)
        .encryptionKey(key)
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
var key = new Key(this, "MyKey");

new Stream(this, "MyEncryptedStream", new StreamProps {
    Encryption = StreamEncryption.KMS,
    EncryptionKey = key
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
key := kms.NewKey(this, jsii.String("MyKey"))

kinesis.NewStream(this, jsii.String("MyEncryptedStream"), &StreamProps{
	Encryption: kinesis.StreamEncryption_KMS,
	EncryptionKey: key,
})
```

## Properties

- `encryption`: [StreamEncryption](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kinesis.StreamEncryption.html) — The kind of server-side encryption to apply to this stream.

  **Default:** StreamEncryption.KMS if encrypted Streams are supported in the region or StreamEncryption.UNENCRYPTED otherwise. StreamEncryption.KMS if an encryption key is supplied through the encryptionKey property

  If you choose KMS, you can specify a KMS key via `encryptionKey`. If
  encryption key is not specified, a key will automatically be created.

- `encryptionKey`: [IKey](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kms.IKey.html) — External KMS key to use for stream encryption.

  **Default:** Kinesis Data Streams master key ('/alias/aws/kinesis'). If encryption is set to StreamEncryption.KMS and this property is undefined, a new KMS key will be created and associated with this stream.

  The 'encryption' property must be set to "Kms".

- `removalPolicy`: [RemovalPolicy](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.RemovalPolicy.html) = RemovalPolicy.RETAIN — Policy to apply when the stream is removed from the stack.

- `retentionPeriod`: [Duration](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = Duration.hours(24) — The number of hours for the data records that are stored in shards to remain accessible.

- `shardCount`: number = 1 — The number of shards for the stream.

  Can only be provided if streamMode is Provisioned.

- `shardLevelMetrics`: [ShardLevelMetrics](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kinesis.ShardLevelMetrics.html)[] — A list of shard-level metrics in properties to enable enhanced monitoring mode.

  **Default:** undefined - AWS Kinesis default is disabled

- `streamMode`: [StreamMode](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kinesis.StreamMode.html) = StreamMode.PROVISIONED — The capacity mode of this stream.

- `streamName`: string = <generated> — Enforces a particular physical stream name.
