CDK Constructs for AWS Kinesis
Project description
Amazon Kinesis Construct Library
---This is a developer preview (public beta) module.
All classes with the
Cfn
prefix in this module (CFN Resources) are auto-generated from CloudFormation. They are stable and safe to use.However, all other classes, i.e., higher level constructs, are under active development and subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.
Amazon Kinesis provides collection and processing of large streams of data records in real time. Kinesis data streams can be used for rapid and continuous data intake and aggregation.
Table Of Contents
Streams
Amazon Kinesis Data Streams ingests a large amount of data in real time, durably stores the data, and makes the data available for consumption.
Using the CDK, a new Kinesis stream can be created as part of the stack using the construct's constructor. You may specify the streamName
to give
your own identifier to the stream. If not, CloudFormation will generate a name.
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
Stream(self, "MyFirstStream",
stream_name="my-awesome-stream"
)
You can also specify properties such as shardCount
to indicate how many shards the stream should choose and a retentionPeriod
to specify how long the data in the shards should remain accessible.
Read more at Creating and Managing Streams
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
Stream(self, "MyFirstStream",
stream_name="my-awesome-stream",
shard_count=3,
retention_period=Duration.hours(48)
)
Encryption
Stream encryption enables server-side encryption using an AWS KMS key for a specified stream.
Encryption is enabled by default on your stream with the master key owned by Kinesis Data Streams in regions where it is supported.
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
Stream(self, "MyEncryptedStream")
You can enable encryption on your stream with a user-managed key by specifying the encryption
property.
A KMS key will be created for you and associated with the stream.
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
Stream(self, "MyEncryptedStream",
encryption=StreamEncryption.KMS
)
You can also supply your own external KMS key to use for stream encryption by specifying the encryptionKey
property.
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
import aws_cdk.aws_kms as kms
key = kms.Key(self, "MyKey")
Stream(self, "MyEncryptedStream",
encryption=StreamEncryption.KMS,
encryption_key=key
)
Import
Any Kinesis stream that has been created outside the stack can be imported into your CDK app.
Streams can be imported by their ARN via the Stream.fromStreamArn()
API
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
stack = Stack(app, "MyStack")
imported_stream = Stream.from_stream_arn(stack, "ImportedStream", "arn:aws:kinesis:us-east-2:123456789012:stream/f3j09j2230j")
Encrypted Streams can also be imported by their attributes via the Stream.fromStreamAttributes()
API
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
from aws_cdk.aws_kms import Key
stack = Stack(app, "MyStack")
imported_stream = Stream.from_stream_attributes(stack, "ImportedEncryptedStream",
stream_arn="arn:aws:kinesis:us-east-2:123456789012:stream/f3j09j2230j",
encryption_key=kms.Key.from_key_arn("arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012")
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for aws-cdk.aws-kinesis-1.32.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b13f3ac545d141ec9060a32d326ecc0286488b9a6c70499f76b038e0aa85cae |
|
MD5 | 997b026a35341072e8103e6515d00bc8 |
|
BLAKE2b-256 | 3c5e52d6156215f736f87a5b51c98ddbea58a4c86e496b4b9d29810e3dce1cd8 |
Hashes for aws_cdk.aws_kinesis-1.32.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d690471140f223d12a1c60954727a7394522f3b033d05595e57fe3d9a931d1b5 |
|
MD5 | e8f8700cc98ada6ef1b0a6ba7234e452 |
|
BLAKE2b-256 | f610a201a943e5b4fdca1bb794ab6c23808bb859b87f9ab3e8361e5f5abfc284 |