Registry / aws / aws-cdk-aws-kinesis

aws-cdk-aws-kinesis

JSON →
library1.204.0pypypi✓ verified 85d ago

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-kinesis
INSTALL
IMPORT
SIG · AWS-CDK-AWS-KINESI
A
aws-cdk-aws-kinesis
awspythonv1.204.0
Install
4.6s avg
Import
Disk
37MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.204.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 37.4MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 4.6s · import 0.000s · 38MB
37MB installed
● package 37MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Stream
from aws_cdk import aws_kinesis as kinesis
from aws_cdk_lib import aws_kinesis as kinesis
This package (`aws-cdk-aws-kinesis`) is for AWS CDK v1. V2 consolidated all constructs under `aws_cdk_lib` and uses a different import path. Ensure `aws-cdk.core` is also imported for v1.

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`).

import aws_cdk as cdk from aws_cdk import aws_kinesis as kinesis from constructs import Construct class MyKinesisStack(cdk.Stack): def __init__(self, scope: Construct, id: str, **kwargs) -> None: super().__init__(scope, id, **kwargs) # Create a Kinesis Data Stream kinesis.Stream(self, "MyCDKStream", stream_name="MyCDKPythonStream", shard_count=1, retention_period=cdk.Duration.hours(24)) app = cdk.App() MyKinesisStack(app, "MyKinesisStack") app.synth()
cdk --version
Debug
Known issues
breakingAWS CDK v1 is in maintenance mode; v2 is the current major version. Migrating from v1 to v2 involves significant changes to package structure and import paths. For v2, all construct libraries are consolidated under `aws-cdk-lib`.
fix
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.
affects: All versions of AWS CDK v1 when migrating to v2
gotchaKinesis Data Streams have a default data retention period of 24 hours. If you require longer data retention (up to 365 days), you must explicitly configure it.
fix
Set the `retention_period` property when defining your `Stream` construct. For example: `retention_period=cdk.Duration.hours(7 * 24)` for 7 days.
affects: All versions of aws-cdk-aws-kinesis
gotchaBy default, Kinesis Data Streams are encrypted at rest using a Kinesis-owned AWS KMS key. If you need to use a customer-managed KMS key (CMK) for compliance or specific key management requirements, you must specify it.
fix
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:...")`
affects: All versions of aws-cdk-aws-kinesis
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'aws_cdk_lib'
You are attempting to use AWS CDK v2 import paths (`from aws_cdk_lib import ...`) while your project is configured for or has only AWS CDK v1 packages (`aws-cdk-aws-kinesis`, `aws-cdk.core`) installed.
fix
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.
TypeError: 'module' object is not callable
This error often occurs when you try to call a module directly, rather than accessing a construct within it (e.g., `kinesis.Stream()` instead of `kinesis.Stream(...)`), or if there's a missing `import aws_cdk as cdk` or `from constructs import Construct` for v1 applications.
fix
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.
Resource CFN_E_TARGET_NOT_FOUND error with message "Stream <stream-name> not found" when deploying.
This runtime error typically indicates that the Kinesis stream either does not exist, or the name/ARN specified in the CDK code does not match an existing stream, especially when attempting to import an existing resource. It can also happen due to region mismatch or if the stream was manually deleted after deployment.
fix
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.
Upgrade
Version history
1.204.0latest on PyPI · released Jun 19, 2023
Audit
Dependencies
aws-cdk.corerequiredRequired for core CDK constructs, app, and stack definitions when using AWS CDK v1.
constructsrequiredUnderlying construct programming model library, used by AWS CDK v1.
Agent activity
20 hits · last 30 days
node
18
Resources
aws-cdk-aws-kinesis — pip install aws-cdk-aws-kinesis · libregistry