The AWS Cloud Development Kit (CDK) Construct Library for AWS Kinesis provides high-level constructs for defining Kinesis streams using familiar programming languages. This entry specifically targets version 1.204.0, which is part of the v1 branch of the AWS CDK. The AWS CDK typically has frequent minor releases (often weekly or bi-weekly) and less frequent major releases (e.g., v1 to v2), with v2 being the currently recommended and actively developed version.
pip install aws-cdk-aws-kinesisVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to create a basic Kinesis Data Stream with a single shard and 24-hour retention using AWS CDK v1 constructs. To run this, you will also need to have `aws-cdk.core` installed (`pip install aws-cdk.core`).
For v2, change your imports from `from aws_cdk import aws_kinesis` to `from aws_cdk_lib import aws_kinesis`. Install `aws-cdk-lib` instead of individual `aws-cdk-aws-*` packages. Use the `cdk migrate` command-line tool for assistance with updating code.
Set the `retention_period` property when defining your `Stream` construct. For example: `retention_period=cdk.Duration.hours(7 * 24)` for 7 days.
Set `encryption=kinesis.StreamEncryption.KMS` and optionally `encryption_key` to a specific KMS key when creating the `Stream` construct. Example: `encryption=kinesis.StreamEncryption.KMS, encryption_key=kms.Key.from_key_arn(self, "MyKey", "arn:aws:kms:...")`
If you intend to use AWS CDK v1, ensure your imports follow the `from aws_cdk import aws_kinesis` pattern and `pip install aws-cdk.core`. If you intend to use v2, `pip install aws-cdk-lib` and update your imports accordingly.
Ensure all necessary imports are present and aliased correctly (`import aws_cdk as cdk`, `from aws_cdk import aws_kinesis as kinesis`, `from constructs import Construct`). Verify that you are instantiating constructs correctly, passing `self`, `id`, and props.
Verify the `stream_name` or `stream_arn` in your CDK code matches the actual resource. If importing, ensure the stream exists. If creating, ensure you're deploying to the correct AWS region. For cross-stack references, ensure the producer stack is deployed first.