@aws-cdk/kinesis

AWS Kinesis Construct Library

Define an unencrypted Kinesis stream.

new Stream(this, 'MyFirstStream');

Encryption

Define a KMS-encrypted stream:

const stream = newStream(this, 'MyEncryptedStream', {
    encryption: StreamEncryption.Kms
});

// you can access the encryption key:
assert(stream.encryptionKey instanceof kms.EncryptionKey);

You can also supply your own key:

const myKmsKey = new kms.EncryptionKey(this, 'MyKey');

const stream = new Stream(this, 'MyEncryptedStream', {
    encryption: StreamEncryption.Kms,
    encryptionKey: myKmsKey
});

assert(stream.encryptionKey === myKmsKey);

Reference

Stream

class _aws-cdk_kinesis.Stream(parent, name[, props])

A Kinesis stream. Can be encrypted with a KMS key.

Extends:

StreamRef

Parameters:
  • parent (Construct) –
  • name (string) –
  • props (StreamProps or None) –
streamArn

The ARN of the stream.

Type:StreamArn (readonly)
streamName
Type:StreamName (readonly)
encryptionKey

Optional KMS encryption key associated with this stream.

Type:EncryptionKeyRef or None (readonly)

StreamEncryption (enum)

class _aws-cdk_kinesis.StreamEncryption
Unencrypted
Kms

StreamName

class _aws-cdk_kinesis.StreamName([valueOrFunction])

The name of the stream.

Extends:Token
Parameters:valueOrFunction (any or None) –

StreamProps (interface)

class _aws-cdk_kinesis.StreamProps
streamName

Enforces a particular physical stream name.

Type:string or None
retentionPeriodHours

The number of hours for the data records that are stored in shards to remain accessible.

Type:number or None
shardCount

The number of shards for the stream.

Type:number or None
encryption

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.

Type:string or None
encryptionKey

External KMS key to use for stream encryption. The ‘encryption’ property must be set to “Kms”.

Type:EncryptionKeyRef or None

StreamRef

class _aws-cdk_kinesis.StreamRef(parent, name)

Represents a Kinesis Stream. Streams can be either defined within this stack: new Stream(this, ‘MyStream’, { props }); Or imported from an existing stream: StreamRef.import(this, ‘MyImportedStream’, { streamArn: … }); You can also export a stream and import it into another stack: const ref = myStream.export(); StreamRef.import(this, ‘MyImportedStream’, ref);

Extends:

Construct

Abstract:

Yes

Parameters:
  • parent (Construct) – The parent construct
  • name (string) –
static import(parent, name, props) → @aws-cdk/kinesis.StreamRef

Creates a Stream construct that represents an external stream.

Parameters:
  • parent (Construct) – The parent creating construct (usually this).
  • name (string) – The construct’s name.
  • props (StreamRefProps) –
Return type:

StreamRef

export() → @aws-cdk/kinesis.StreamRefProps

Exports this stream from the stack.

Return type:StreamRefProps
grantRead([identity])

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:identity (IIdentityResource or None) –
grantWrite([identity])

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:identity (IIdentityResource or None) –
grantReadWrite([identity])

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:identity (IIdentityResource or None) –
streamArn

The ARN of the stream.

Type:StreamArn (readonly) (abstract)
encryptionKey

Optional KMS encryption key associated with this stream.

Type:EncryptionKeyRef or None (readonly) (abstract)

StreamRefProps (interface)

class _aws-cdk_kinesis.StreamRefProps

A reference to a stream. The easiest way to instantiate is to call stream.export(). Then, the consumer can use Stream.import(this, ref) and get a Stream.

streamArn

The ARN of the stream.

Type:StreamArn
encryptionKey

The KMS key securing the contents of the stream if encryption is enabled.

Type:EncryptionKeyRefProps or None