Stream

class aws_cdk.aws_kinesis.Stream(scope, id, *, encryption=None, encryption_key=None, retention_period_hours=None, shard_count=None, stream_name=None)

Bases: aws_cdk.core.Resource

A Kinesis stream.

Can be encrypted with a KMS key.

stability :stability: experimental

__init__(scope, id, *, encryption=None, encryption_key=None, retention_period_hours=None, shard_count=None, stream_name=None)
Parameters
  • scope (Construct) –

  • id (str) –

  • encryption (Optional[StreamEncryption]) – The kind of server-side encryption to apply to this stream. If you choose KMS, you can specify a KMS key via encryptionKey. If encryption key is not specified, a key will automatically be created. Default: Unencrypted

  • encryption_key (Optional[IKey]) – External KMS key to use for stream encryption. The ‘encryption’ property must be set to “Kms”. Default: If encryption is set to “Kms” and this property is undefined, a new KMS key will be created and associated with this stream.

  • retention_period_hours (Union[int, float, None]) – The number of hours for the data records that are stored in shards to remain accessible. Default: 24

  • shard_count (Union[int, float, None]) – The number of shards for the stream. Default: 1

  • stream_name (Optional[str]) – Enforces a particular physical stream name. Default:

stability :stability: experimental

Return type

None

Methods

grant_read(grantee)

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 decrypt the contents of the stream will also be granted.

Parameters

grantee (IGrantable) –

stability :stability: experimental

Return type

Grant

grant_read_write(grantee)

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.

Parameters

grantee (IGrantable) –

stability :stability: experimental

Return type

Grant

grant_write(grantee)

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.

Parameters

grantee (IGrantable) –

stability :stability: experimental

Return type

Grant

to_string()

Returns a string representation of this construct.

Return type

str

Attributes

encryption_key

Optional KMS encryption key associated with this stream.

stability :stability: experimental

Return type

Optional[IKey]

node

The construct tree node associated with this construct.

Return type

ConstructNode

stack

The stack in which this resource is defined.

Return type

Stack

stream_arn

The ARN of the stream.

stability :stability: experimental

Return type

str

stream_name

The name of the stream.

stability :stability: experimental

Return type

str

Static Methods

classmethod from_stream_arn(scope, id, stream_arn)

Import an existing Kinesis Stream provided an ARN.

Parameters
  • scope (Construct) – The parent creating construct (usually this).

  • id (str) – The construct’s name.

  • stream_arn (str) – Stream ARN (i.e. arn:aws:kinesis:::stream/Foo).

stability :stability: experimental

Return type

IStream

classmethod from_stream_attributes(scope, id, *, stream_arn, encryption_key=None)

Creates a Stream construct that represents an external stream.

Parameters
  • scope (Construct) – The parent creating construct (usually this).

  • id (str) – The construct’s name.

  • stream_arn (str) – The ARN of the stream.

  • encryption_key (Optional[IKey]) – The KMS key securing the contents of the stream if encryption is enabled. Default: - No encryption

stability :stability: experimental

Return type

IStream

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters

x (Any) –

Return type

bool