# IStream

A Kinesis Stream.

Extends: IStream
Extends: IResource, IStreamRef
Implemented by: Stream

- Source: [`aws-kinesis/lib/stream.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-kinesis/lib/stream.ts#L89)
- Type last changed: v2.234.0 · 8 Jan 2026

## Properties

- `encryptionKey`: [IKey](/cdk/api/v2/docs/aws-cdk-lib.aws_kms.IKey.html) — Optional KMS encryption key associated with this stream.

- `env`: [ResourceEnvironment](/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html) (required) — The environment this resource belongs to.

  For resources that are created and managed in a Stack (those created by
  creating new class instances like `new Role()`, `new Bucket()`, etc.), this
  is always the same as the environment of the stack they belong to.

  For referenced resources (those obtained from referencing methods like
  `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
  different than the stack they were imported into.

- `node`: [Node](/cdk/api/v2/docs/constructs.Node.html) (required) — The tree node.

- `stack`: [Stack](/cdk/api/v2/docs/aws-cdk-lib.Stack.html) (required) — The stack in which this resource is defined.

- `streamArn`: string (required) — The ARN of the stream.

- `streamName`: string (required) — The name of the stream.

- `streamRef`: [StreamReference](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_kinesis.StreamReference.html) (required) — A reference to a Stream resource.

## Methods

- `addToResourcePolicy(statement: PolicyStatement): AddToResourcePolicyResult` — Adds a statement to the IAM resource policy associated with this stream.

  If this stream was created in this stack (`new Stream`), a resource policy
  will be automatically created upon the first call to `addToResourcePolicy`. If
  the stream is imported (`Stream.import`), then this is a no-op.

- `applyRemovalPolicy(policy: RemovalPolicy): void` — Apply the given removal policy to this resource.

  The Removal Policy controls what happens to this resource when it stops
  being managed by CloudFormation, either because you've removed it from the
  CDK application or because you've made a change that requires the resource
  to be replaced.

  The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
  account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).

- `grant(grantee: IGrantable, ...actions: string[]): Grant` — Grant the indicated permissions on this stream to the provided IAM principal.

- `grantRead(grantee: IGrantable): Grant` — Grant read permissions for this stream and its contents to an IAM principal (Role/Group/User).

  If an encryption key is used, permission to ues the key to decrypt the
  contents of the stream will also be granted.

- `grantReadWrite(grantee: IGrantable): Grant` — Grants read/write permissions for this stream and its contents to an IAM principal (Role/Group/User).

  If an encryption key is used, permission to use the key for
  encrypt/decrypt will also be granted.

- `grantWrite(grantee: IGrantable): Grant` — Grant write permissions for this stream and its contents to an IAM principal (Role/Group/User).

  If an encryption key is used, permission to ues the key to encrypt the
  contents of the stream will also be granted.

- `metric(metricName: string, props?: MetricOptions): Metric` — Return stream metric based from its metric name.

  **Parameters**

  - `metricName` — name of the stream metric.
  - `props` — properties of the metric.

- `metricGetRecords(props?: MetricOptions): Metric` — The number of records retrieved from the shard, measured over the specified time period.

  Minimum, Maximum, and
  Average statistics represent the records in a single GetRecords operation for the stream in the specified time
  period.

  The metric defaults to average over 5 minutes, it can be changed by passing `statistic` and `period` properties.

  **Parameters**

  - `props` — properties of the metric.

- `metricGetRecordsBytes(props?: MetricOptions): Metric` — The number of bytes retrieved from the Kinesis stream, measured over the specified time period.

  Minimum, Maximum,
  and Average statistics represent the bytes in a single GetRecords operation for the stream in the specified time
  period.

  The metric defaults to average over 5 minutes, it can be changed by passing `statistic` and `period` properties.

  **Parameters**

  - `props` — properties of the metric.

- `metricGetRecordsIteratorAgeMilliseconds(props?: MetricOptions): Metric` — The age of the last record in all GetRecords calls made against a Kinesis stream, measured over the specified time period.

  Age is the difference between the current time and when the last record of the GetRecords call was written
  to the stream. The Minimum and Maximum statistics can be used to track the progress of Kinesis consumer
  applications. A value of zero indicates that the records being read are completely caught up with the stream.

  The metric defaults to maximum over 5 minutes, it can be changed by passing `statistic` and `period` properties.

  **Parameters**

  - `props` — properties of the metric.

- `metricGetRecordsLatency(props?: MetricOptions): Metric` — The time taken per GetRecords operation, measured over the specified time period.

  The metric defaults to average over 5 minutes, it can be changed by passing `statistic` and `period` properties.

  **Parameters**

  - `props` — properties of the metric.

- `metricGetRecordsSuccess(props?: MetricOptions): Metric` — The number of successful GetRecords operations per stream, measured over the specified time period.

  The metric defaults to average over 5 minutes, it can be changed by passing `statistic` and `period` properties.

  **Parameters**

  - `props` — properties of the metric.

- `metricIncomingBytes(props?: MetricOptions): Metric` — The number of bytes successfully put to the Kinesis stream over the specified time period.

  This metric includes
  bytes from PutRecord and PutRecords operations. Minimum, Maximum, and Average statistics represent the bytes in a
  single put operation for the stream in the specified time period.

  The metric defaults to average over 5 minutes, it can be changed by passing `statistic` and `period` properties.

  **Parameters**

  - `props` — properties of the metric.

- `metricIncomingRecords(props?: MetricOptions): Metric` — The number of records successfully put to the Kinesis stream over the specified time period.

  This metric includes
  record counts from PutRecord and PutRecords operations. Minimum, Maximum, and Average statistics represent the
  records in a single put operation for the stream in the specified time period.

  The metric defaults to average over 5 minutes, it can be changed by passing `statistic` and `period` properties.

  **Parameters**

  - `props` — properties of the metric.

- `metricPutRecordBytes(props?: MetricOptions): Metric` — The number of bytes put to the Kinesis stream using the PutRecord operation over the specified time period.

  The metric defaults to average over 5 minutes, it can be changed by passing `statistic` and `period` properties.

  **Parameters**

  - `props` — properties of the metric.

- `metricPutRecordLatency(props?: MetricOptions): Metric` — The time taken per PutRecord operation, measured over the specified time period.

  The metric defaults to average over 5 minutes, it can be changed by passing `statistic` and `period` properties.

  **Parameters**

  - `props` — properties of the metric.

- `metricPutRecordsBytes(props?: MetricOptions): Metric` — The number of bytes put to the Kinesis stream using the PutRecords operation over the specified time period.

  The metric defaults to average over 5 minutes, it can be changed by passing `statistic` and `period` properties.

  **Parameters**

  - `props` — properties of the metric.

- `metricPutRecordsFailedRecords(props?: MetricOptions): Metric` — The number of records rejected due to internal failures in a PutRecords operation per Kinesis data stream, measured over the specified time period.

  Occasional internal failures are to be expected and should be retried.

  The metric defaults to average over 5 minutes, it can be changed by passing `statistic` and `period` properties.

  **Parameters**

  - `props` — properties of the metric.

- `metricPutRecordsLatency(props?: MetricOptions): Metric` — The time taken per PutRecords operation, measured over the specified time period.

  The metric defaults to average over 5 minutes, it can be changed by passing `statistic` and `period` properties.

  **Parameters**

  - `props` — properties of the metric.

- `metricPutRecordsSuccess(props?: MetricOptions): Metric` — The number of PutRecords operations where at least one record succeeded, per Kinesis stream, measured over the specified time period.

  The metric defaults to average over 5 minutes, it can be changed by passing `statistic` and `period` properties.

  **Parameters**

  - `props` — properties of the metric.

- `metricPutRecordsSuccessfulRecords(props?: MetricOptions): Metric` — The number of successful records in a PutRecords operation per Kinesis data stream, measured over the specified time period.

  The metric defaults to average over 5 minutes, it can be changed by passing `statistic` and `period` properties.

  **Parameters**

  - `props` — properties of the metric.

- `metricPutRecordsThrottledRecords(props?: MetricOptions): Metric` — The number of records rejected due to throttling in a PutRecords operation per Kinesis data stream, measured over the specified time period.

  The metric defaults to average over 5 minutes, it can be changed by passing `statistic` and `period` properties.

  **Parameters**

  - `props` — properties of the metric.

- `metricPutRecordsTotalRecords(props?: MetricOptions): Metric` — The total number of records sent in a PutRecords operation per Kinesis data stream, measured over the specified time period.

  The metric defaults to average over 5 minutes, it can be changed by passing `statistic` and `period` properties.

  **Parameters**

  - `props` — properties of the metric.

- `metricPutRecordSuccess(props?: MetricOptions): Metric` — The number of successful PutRecord operations per Kinesis stream, measured over the specified time period.

  Average
  reflects the percentage of successful writes to a stream.

  The metric defaults to average over 5 minutes, it can be changed by passing `statistic` and `period` properties.

  **Parameters**

  - `props` — properties of the metric.

- `metricReadProvisionedThroughputExceeded(props?: MetricOptions): Metric` — The number of GetRecords calls throttled for the stream over the specified time period.

  The most commonly used
  statistic for this metric is Average.

  When the Minimum statistic has a value of 1, all records were throttled for the stream during the specified time
  period.

  When the Maximum statistic has a value of 0 (zero), no records were throttled for the stream during the specified
  time period.

  The metric defaults to average over 5 minutes, it can be changed by passing `statistic` and `period` properties

  **Parameters**

  - `props` — properties of the metric.

- `metricWriteProvisionedThroughputExceeded(props?: MetricOptions): Metric` — The number of records rejected due to throttling for the stream over the specified time period.

  This metric
  includes throttling from PutRecord and PutRecords operations.

  When the Minimum statistic has a non-zero value, records were being throttled for the stream during the specified
  time period.

  When the Maximum statistic has a value of 0 (zero), no records were being throttled for the stream during the
  specified time period.

  The metric defaults to average over 5 minutes, it can be changed by passing `statistic` and `period` properties.

  **Parameters**

  - `props` — properties of the metric.

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  Mixins are applied in order. The list of constructs is captured at the
  start of the call, so constructs added by a mixin will not be visited.

  **Parameters**

  - `mixins` — The mixins to apply.

  **Returns:** This construct for chaining
