Class Stream
A Kinesis stream.
Inherited Members
Namespace: Amazon.CDK.AWS.Kinesis
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class Stream : Resource, IStream, IResource
Syntax (vb)
Public Class Stream
Inherits Resource
Implements IStream, IResource
Remarks
Can be encrypted with a KMS key.
ExampleMetadata: infused
Examples
var lambdaRole = new Role(this, "Role", new RoleProps {
AssumedBy = new ServicePrincipal("lambda.amazonaws.com"),
Description = "Example role..."
});
var stream = new Stream(this, "MyEncryptedStream", new StreamProps {
Encryption = StreamEncryption.KMS
});
// give lambda permissions to read stream
stream.GrantRead(lambdaRole);
Synopsis
Constructors
Stream(By |
Used by jsii to construct an instance of this class from a Javascript-owned object reference |
Stream(Deputy |
Used by jsii to construct an instance of this class from DeputyProps |
Stream(Construct, String, IStream |
Properties
Auto |
Indicates if a stream resource policy should automatically be created upon the first call to |
Encryption |
Optional KMS encryption key associated with this stream. |
Stream |
The ARN of the stream. |
Stream |
The name of the stream. |
Methods
Add |
Adds a statement to the IAM resource policy associated with this stream. |
From |
Import an existing Kinesis Stream provided an ARN. |
From |
Creates a Stream construct that represents an external stream. |
Grant(IGrantable, String[]) | Grant the indicated permissions on this stream to the given IAM principal (Role/Group/User). |
Grant |
Grant read permissions for this stream and its contents to an IAM principal (Role/Group/User). |
Grant |
Grants read/write permissions for this stream and its contents to an IAM principal (Role/Group/User). |
Grant |
Grant write permissions for this stream and its contents to an IAM principal (Role/Group/User). |
Metric(String, IMetric |
Return stream metric based from its metric name. |
Metric |
The number of records retrieved from the shard, measured over the specified time period. |
Metric |
The number of bytes retrieved from the Kinesis stream, measured over the specified time period. |
Metric |
The age of the last record in all GetRecords calls made against a Kinesis stream, measured over the specified time period. |
Metric |
The number of successful GetRecords operations per stream, measured over the specified time period. |
Metric |
The number of successful GetRecords operations per stream, measured over the specified time period. |
Metric |
The number of bytes successfully put to the Kinesis stream over the specified time period. |
Metric |
The number of records successfully put to the Kinesis stream over the specified time period. |
Metric |
The number of bytes put to the Kinesis stream using the PutRecord operation over the specified time period. |
Metric |
The time taken per PutRecord operation, measured over the specified time period. |
Metric |
The number of bytes put to the Kinesis stream using the PutRecords operation over the specified time period. |
Metric |
The number of records rejected due to internal failures in a PutRecords operation per Kinesis data stream, measured over the specified time period. |
Metric |
The time taken per PutRecords operation, measured over the specified time period. |
Metric |
The number of PutRecords operations where at least one record succeeded, per Kinesis stream, measured over the specified time period. |
Metric |
The number of successful records in a PutRecords operation per Kinesis data stream, measured over the specified time period. |
Metric |
The number of records rejected due to throttling in a PutRecords operation per Kinesis data stream, measured over the specified time period. |
Metric |
The total number of records sent in a PutRecords operation per Kinesis data stream, measured over the specified time period. |
Metric |
The number of successful PutRecord operations per Kinesis stream, measured over the specified time period. |
Metric |
The number of GetRecords calls throttled for the stream over the specified time period. |
Metric |
The number of records rejected due to throttling for the stream over the specified time period. |
Constructors
Stream(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected Stream(ByRefValue reference)
Parameters
- reference Amazon.
JSII. Runtime. Deputy. By Ref Value The Javascript-owned object reference
Stream(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected Stream(DeputyBase.DeputyProps props)
Parameters
- props Amazon.
JSII. Runtime. Deputy. Deputy Base. Deputy Props The deputy props
Stream(Construct, String, IStreamProps)
public Stream(Construct scope, string id, IStreamProps props = null)
Parameters
- scope Constructs.
Construct - id System.
String - props IStream
Props
Properties
AutoCreatePolicy
Indicates if a stream resource policy should automatically be created upon the first call to addToResourcePolicy
.
protected virtual bool AutoCreatePolicy { get; }
Property Value
System.
Remarks
Set by subclasses.
EncryptionKey
Optional KMS encryption key associated with this stream.
public virtual IKey EncryptionKey { get; }
Property Value
StreamArn
The ARN of the stream.
public virtual string StreamArn { get; }
Property Value
System.
StreamName
The name of the stream.
public virtual string StreamName { get; }
Property Value
System.
Methods
AddToResourcePolicy(PolicyStatement)
Adds a statement to the IAM resource policy associated with this stream.
public virtual IAddToResourcePolicyResult AddToResourcePolicy(PolicyStatement statement)
Parameters
- statement Policy
Statement
Returns
Remarks
If this stream was created in this stack (new Stream
), a resource policy
will be automatically created upon the first call to addToResourcePolicy
. If
the stream is imported (Stream.import
), then this is a no-op.
FromStreamArn(Construct, String, String)
Import an existing Kinesis Stream provided an ARN.
public static IStream FromStreamArn(Construct scope, string id, string streamArn)
Parameters
- scope Constructs.
Construct The parent creating construct (usually
this
).- id System.
String The construct's name.
- streamArn System.
String Stream ARN (i.e. arn:aws:kinesis:<region>:<account-id>:stream/Foo).
Returns
FromStreamAttributes(Construct, String, IStreamAttributes)
Creates a Stream construct that represents an external stream.
public static IStream FromStreamAttributes(Construct scope, string id, IStreamAttributes attrs)
Parameters
- scope Constructs.
Construct The parent creating construct (usually
this
).- id System.
String The construct's name.
- attrs IStream
Attributes Stream import properties.
Returns
Grant(IGrantable, String[])
Grant the indicated permissions on this stream to the given IAM principal (Role/Group/User).
public virtual Grant Grant(IGrantable grantee, params string[] actions)
Parameters
- grantee IGrantable
- actions System.
String []
Returns
GrantRead(IGrantable)
Grant read permissions for this stream and its contents to an IAM principal (Role/Group/User).
public virtual Grant GrantRead(IGrantable grantee)
Parameters
- grantee IGrantable
Returns
Remarks
If an encryption key is used, permission to ues the key to decrypt the contents of the stream will also be granted.
GrantReadWrite(IGrantable)
Grants read/write permissions for this stream and its contents to an IAM principal (Role/Group/User).
public virtual Grant GrantReadWrite(IGrantable grantee)
Parameters
- grantee IGrantable
Returns
Remarks
If an encryption key is used, permission to use the key for encrypt/decrypt will also be granted.
GrantWrite(IGrantable)
Grant write permissions for this stream and its contents to an IAM principal (Role/Group/User).
public virtual Grant GrantWrite(IGrantable grantee)
Parameters
- grantee IGrantable
Returns
Remarks
If an encryption key is used, permission to ues the key to encrypt the contents of the stream will also be granted.
Metric(String, IMetricOptions)
Return stream metric based from its metric name.
public virtual Metric Metric(string metricName, IMetricOptions props = null)
Parameters
- metricName System.
String name of the stream metric.
- props IMetric
Options properties of the metric.
Returns
MetricGetRecords(IMetricOptions)
The number of records retrieved from the shard, measured over the specified time period.
public virtual Metric MetricGetRecords(IMetricOptions props = null)
Parameters
- props IMetric
Options properties of the metric.
Returns
Remarks
Minimum, Maximum, and Average statistics represent the records in a single GetRecords operation for the stream in the specified time period.
average
The metric defaults to average over 5 minutes, it can be changed by passing statistic
and period
properties.
MetricGetRecordsBytes(IMetricOptions)
The number of bytes retrieved from the Kinesis stream, measured over the specified time period.
public virtual Metric MetricGetRecordsBytes(IMetricOptions props = null)
Parameters
- props IMetric
Options properties of the metric.
Returns
Remarks
Minimum, Maximum, and Average statistics represent the bytes in a single GetRecords operation for the stream in the specified time period.
The metric defaults to average over 5 minutes, it can be changed by passing statistic
and period
properties.
MetricGetRecordsIteratorAgeMilliseconds(IMetricOptions)
The age of the last record in all GetRecords calls made against a Kinesis stream, measured over the specified time period.
public virtual Metric MetricGetRecordsIteratorAgeMilliseconds(IMetricOptions props = null)
Parameters
- props IMetric
Options properties of the metric.
Returns
Remarks
Age is the difference between the current time and when the last record of the GetRecords call was written to the stream. The Minimum and Maximum statistics can be used to track the progress of Kinesis consumer applications. A value of zero indicates that the records being read are completely caught up with the stream.
The metric defaults to maximum over 5 minutes, it can be changed by passing statistic
and period
properties.
MetricGetRecordsLatency(IMetricOptions)
The number of successful GetRecords operations per stream, measured over the specified time period.
public virtual Metric MetricGetRecordsLatency(IMetricOptions props = null)
Parameters
- props IMetric
Options properties of the metric.
Returns
Remarks
The metric defaults to average over 5 minutes, it can be changed by passing statistic
and period
properties.
MetricGetRecordsSuccess(IMetricOptions)
The number of successful GetRecords operations per stream, measured over the specified time period.
public virtual Metric MetricGetRecordsSuccess(IMetricOptions props = null)
Parameters
- props IMetric
Options properties of the metric.
Returns
Remarks
The metric defaults to average over 5 minutes, it can be changed by passing statistic
and period
properties.
MetricIncomingBytes(IMetricOptions)
The number of bytes successfully put to the Kinesis stream over the specified time period.
public virtual Metric MetricIncomingBytes(IMetricOptions props = null)
Parameters
- props IMetric
Options properties of the metric.
Returns
Remarks
This metric includes bytes from PutRecord and PutRecords operations. Minimum, Maximum, and Average statistics represent the bytes in a single put operation for the stream in the specified time period.
The metric defaults to average over 5 minutes, it can be changed by passing statistic
and period
properties.
MetricIncomingRecords(IMetricOptions)
The number of records successfully put to the Kinesis stream over the specified time period.
public virtual Metric MetricIncomingRecords(IMetricOptions props = null)
Parameters
- props IMetric
Options properties of the metric.
Returns
Remarks
This metric includes record counts from PutRecord and PutRecords operations. Minimum, Maximum, and Average statistics represent the records in a single put operation for the stream in the specified time period.
The metric defaults to average over 5 minutes, it can be changed by passing statistic
and period
properties.
MetricPutRecordBytes(IMetricOptions)
The number of bytes put to the Kinesis stream using the PutRecord operation over the specified time period.
public virtual Metric MetricPutRecordBytes(IMetricOptions props = null)
Parameters
- props IMetric
Options properties of the metric.
Returns
Remarks
The metric defaults to average over 5 minutes, it can be changed by passing statistic
and period
properties.
MetricPutRecordLatency(IMetricOptions)
The time taken per PutRecord operation, measured over the specified time period.
public virtual Metric MetricPutRecordLatency(IMetricOptions props = null)
Parameters
- props IMetric
Options properties of the metric.
Returns
Remarks
The metric defaults to average over 5 minutes, it can be changed by passing statistic
and period
properties.
MetricPutRecordsBytes(IMetricOptions)
The number of bytes put to the Kinesis stream using the PutRecords operation over the specified time period.
public virtual Metric MetricPutRecordsBytes(IMetricOptions props = null)
Parameters
- props IMetric
Options properties of the metric.
Returns
Remarks
The metric defaults to average over 5 minutes, it can be changed by passing statistic
and period
properties.
MetricPutRecordsFailedRecords(IMetricOptions)
The number of records rejected due to internal failures in a PutRecords operation per Kinesis data stream, measured over the specified time period.
public virtual Metric MetricPutRecordsFailedRecords(IMetricOptions props = null)
Parameters
- props IMetric
Options properties of the metric.
Returns
Remarks
Occasional internal failures are to be expected and should be retried.
The metric defaults to average over 5 minutes, it can be changed by passing statistic
and period
properties.
MetricPutRecordsLatency(IMetricOptions)
The time taken per PutRecords operation, measured over the specified time period.
public virtual Metric MetricPutRecordsLatency(IMetricOptions props = null)
Parameters
- props IMetric
Options properties of the metric.
Returns
Remarks
The metric defaults to average over 5 minutes, it can be changed by passing statistic
and period
properties.
MetricPutRecordsSuccess(IMetricOptions)
The number of PutRecords operations where at least one record succeeded, per Kinesis stream, measured over the specified time period.
public virtual Metric MetricPutRecordsSuccess(IMetricOptions props = null)
Parameters
- props IMetric
Options properties of the metric.
Returns
Remarks
The metric defaults to average over 5 minutes, it can be changed by passing statistic
and period
properties.
MetricPutRecordsSuccessfulRecords(IMetricOptions)
The number of successful records in a PutRecords operation per Kinesis data stream, measured over the specified time period.
public virtual Metric MetricPutRecordsSuccessfulRecords(IMetricOptions props = null)
Parameters
- props IMetric
Options properties of the metric.
Returns
Remarks
The metric defaults to average over 5 minutes, it can be changed by passing statistic
and period
properties.
MetricPutRecordsThrottledRecords(IMetricOptions)
The number of records rejected due to throttling in a PutRecords operation per Kinesis data stream, measured over the specified time period.
public virtual Metric MetricPutRecordsThrottledRecords(IMetricOptions props = null)
Parameters
- props IMetric
Options properties of the metric.
Returns
Remarks
The metric defaults to average over 5 minutes, it can be changed by passing statistic
and period
properties.
MetricPutRecordsTotalRecords(IMetricOptions)
The total number of records sent in a PutRecords operation per Kinesis data stream, measured over the specified time period.
public virtual Metric MetricPutRecordsTotalRecords(IMetricOptions props = null)
Parameters
- props IMetric
Options properties of the metric.
Returns
Remarks
The metric defaults to average over 5 minutes, it can be changed by passing statistic
and period
properties.
MetricPutRecordSuccess(IMetricOptions)
The number of successful PutRecord operations per Kinesis stream, measured over the specified time period.
public virtual Metric MetricPutRecordSuccess(IMetricOptions props = null)
Parameters
- props IMetric
Options properties of the metric.
Returns
Remarks
Average reflects the percentage of successful writes to a stream.
The metric defaults to average over 5 minutes, it can be changed by passing statistic
and period
properties.
MetricReadProvisionedThroughputExceeded(IMetricOptions)
The number of GetRecords calls throttled for the stream over the specified time period.
public virtual Metric MetricReadProvisionedThroughputExceeded(IMetricOptions props = null)
Parameters
- props IMetric
Options properties of the metric.
Returns
Remarks
The most commonly used statistic for this metric is Average.
When the Minimum statistic has a value of 1, all records were throttled for the stream during the specified time period.
When the Maximum statistic has a value of 0 (zero), no records were throttled for the stream during the specified time period.
The metric defaults to average over 5 minutes, it can be changed by passing statistic
and period
properties
MetricWriteProvisionedThroughputExceeded(IMetricOptions)
The number of records rejected due to throttling for the stream over the specified time period.
public virtual Metric MetricWriteProvisionedThroughputExceeded(IMetricOptions props = null)
Parameters
- props IMetric
Options properties of the metric.
Returns
Remarks
This metric includes throttling from PutRecord and PutRecords operations.
When the Minimum statistic has a non-zero value, records were being throttled for the stream during the specified time period.
When the Maximum statistic has a value of 0 (zero), no records were being throttled for the stream during the specified time period.
The metric defaults to average over 5 minutes, it can be changed by passing statistic
and period
properties.