2021/11/30 - Amazon Kinesis - 1 new4 updated api methods
Changes Amazon Kinesis Data Streams now supports on demand streams.
Updates the capacity mode of the data stream. Currently, in Kinesis Data Streams, you can choose between an on-demand capacity mode and a provisioned capacity mode for your data stream.
See also: AWS API Documentation
Request Syntax
client.update_stream_mode( StreamARN='string', StreamModeDetails={ 'StreamMode': 'PROVISIONED'|'ON_DEMAND' } )
string
[REQUIRED]
Specifies the ARN of the data stream whose capacity mode you want to update.
dict
[REQUIRED]
Specifies the capacity mode to which you want to set your data stream. Currently, in Kinesis Data Streams, you can choose between an on-demand capacity mode and a provisioned capacity mode for your data streams.
StreamMode (string) -- [REQUIRED]
Specifies the capacity mode to which you want to set your data stream. Currently, in Kinesis Data Streams, you can choose between an on-demand capacity mode and a provisioned capacity mode for your data streams.
None
{'StreamModeDetails': {'StreamMode': 'PROVISIONED | ON_DEMAND'}}
Creates a Kinesis data stream. A stream captures and transports data records that are continuously emitted from different data sources or producers. Scale-out within a stream is explicitly supported by means of shards, which are uniquely identified groups of data records in a stream.
You specify and control the number of shards that a stream is composed of. Each shard can support reads up to five transactions per second, up to a maximum data read total of 2 MiB per second. Each shard can support writes up to 1,000 records per second, up to a maximum data write total of 1 MiB per second. If the amount of data input increases or decreases, you can add or remove shards.
The stream name identifies the stream. The name is scoped to the Amazon Web Services account used by the application. It is also scoped by Amazon Web Services Region. That is, two streams in two different accounts can have the same name, and two streams in the same account, but in two different Regions, can have the same name.
CreateStream is an asynchronous operation. Upon receiving a CreateStream request, Kinesis Data Streams immediately returns and sets the stream status to CREATING. After the stream is created, Kinesis Data Streams sets the stream status to ACTIVE. You should perform read and write operations only on an ACTIVE stream.
You receive a LimitExceededException when making a CreateStream request when you try to do one of the following:
Have more than five streams in the CREATING state at any point in time.
Create more shards than are authorized for your account.
For the default shard limit for an Amazon Web Services account, see Amazon Kinesis Data Streams Limits in the Amazon Kinesis Data Streams Developer Guide. To increase this limit, contact Amazon Web Services Support.
You can use DescribeStreamSummary to check the stream status, which is returned in StreamStatus.
CreateStream has a limit of five transactions per second per account.
See also: AWS API Documentation
Request Syntax
client.create_stream( StreamName='string', ShardCount=123, StreamModeDetails={ 'StreamMode': 'PROVISIONED'|'ON_DEMAND' } )
string
[REQUIRED]
A name to identify the stream. The stream name is scoped to the Amazon Web Services account used by the application that creates the stream. It is also scoped by Amazon Web Services Region. That is, two streams in two different Amazon Web Services accounts can have the same name. Two streams in the same Amazon Web Services account but in two different Regions can also have the same name.
integer
The number of shards that the stream will use. The throughput of the stream is a function of the number of shards; more shards are required for greater provisioned throughput.
dict
Indicates the capacity mode of the data stream. Currently, in Kinesis Data Streams, you can choose between an on-demand capacity mode and a provisioned capacity mode for your data streams.
StreamMode (string) -- [REQUIRED]
Specifies the capacity mode to which you want to set your data stream. Currently, in Kinesis Data Streams, you can choose between an on-demand capacity mode and a provisioned capacity mode for your data streams.
None
{'OnDemandStreamCount': 'integer', 'OnDemandStreamCountLimit': 'integer'}
Describes the shard limits and usage for the account.
If you update your account limits, the old limits might be returned for a few minutes.
This operation has a limit of one transaction per second per account.
See also: AWS API Documentation
Request Syntax
client.describe_limits()
dict
Response Syntax
{ 'ShardLimit': 123, 'OpenShardCount': 123, 'OnDemandStreamCount': 123, 'OnDemandStreamCountLimit': 123 }
Response Structure
(dict) --
ShardLimit (integer) --
The maximum number of shards.
OpenShardCount (integer) --
The number of open shards.
OnDemandStreamCount (integer) --
Indicates the number of data streams with the on-demand capacity mode.
OnDemandStreamCountLimit (integer) --
The maximum number of data streams with the on-demand capacity mode.
{'StreamDescription': {'StreamModeDetails': {'StreamMode': 'PROVISIONED | ' 'ON_DEMAND'}}}
Describes the specified Kinesis data stream.
The information returned includes the stream name, Amazon Resource Name (ARN), creation time, enhanced metric configuration, and shard map. The shard map is an array of shard objects. For each shard object, there is the hash key and sequence number ranges that the shard spans, and the IDs of any earlier shards that played in a role in creating the shard. Every record ingested in the stream is identified by a sequence number, which is assigned when the record is put into the stream.
You can limit the number of shards returned by each call. For more information, see Retrieving Shards from a Stream in the Amazon Kinesis Data Streams Developer Guide.
There are no guarantees about the chronological order shards returned. To process shards in chronological order, use the ID of the parent shard to track the lineage to the oldest shard.
This operation has a limit of 10 transactions per second per account.
See also: AWS API Documentation
Request Syntax
client.describe_stream( StreamName='string', Limit=123, ExclusiveStartShardId='string' )
string
[REQUIRED]
The name of the stream to describe.
integer
The maximum number of shards to return in a single call. The default value is 100. If you specify a value greater than 100, at most 100 results are returned.
string
The shard ID of the shard to start with.
Specify this parameter to indicate that you want to describe the stream starting with the shard whose ID immediately follows ExclusiveStartShardId.
If you don't specify this parameter, the default behavior for DescribeStream is to describe the stream starting with the first shard in the stream.
dict
Response Syntax
{ 'StreamDescription': { 'StreamName': 'string', 'StreamARN': 'string', 'StreamStatus': 'CREATING'|'DELETING'|'ACTIVE'|'UPDATING', 'StreamModeDetails': { 'StreamMode': 'PROVISIONED'|'ON_DEMAND' }, 'Shards': [ { 'ShardId': 'string', 'ParentShardId': 'string', 'AdjacentParentShardId': 'string', 'HashKeyRange': { 'StartingHashKey': 'string', 'EndingHashKey': 'string' }, 'SequenceNumberRange': { 'StartingSequenceNumber': 'string', 'EndingSequenceNumber': 'string' } }, ], 'HasMoreShards': True|False, 'RetentionPeriodHours': 123, 'StreamCreationTimestamp': datetime(2015, 1, 1), 'EnhancedMonitoring': [ { 'ShardLevelMetrics': [ 'IncomingBytes'|'IncomingRecords'|'OutgoingBytes'|'OutgoingRecords'|'WriteProvisionedThroughputExceeded'|'ReadProvisionedThroughputExceeded'|'IteratorAgeMilliseconds'|'ALL', ] }, ], 'EncryptionType': 'NONE'|'KMS', 'KeyId': 'string' } }
Response Structure
(dict) --
Represents the output for DescribeStream.
StreamDescription (dict) --
The current status of the stream, the stream Amazon Resource Name (ARN), an array of shard objects that comprise the stream, and whether there are more shards available.
StreamName (string) --
The name of the stream being described.
StreamARN (string) --
The Amazon Resource Name (ARN) for the stream being described.
StreamStatus (string) --
The current status of the stream being described. The stream status is one of the following states:
CREATING - The stream is being created. Kinesis Data Streams immediately returns and sets StreamStatus to CREATING.
DELETING - The stream is being deleted. The specified stream is in the DELETING state until Kinesis Data Streams completes the deletion.
ACTIVE - The stream exists and is ready for read and write operations or deletion. You should perform read and write operations only on an ACTIVE stream.
UPDATING - Shards in the stream are being merged or split. Read and write operations continue to work while the stream is in the UPDATING state.
StreamModeDetails (dict) --
Specifies the capacity mode to which you want to set your data stream. Currently, in Kinesis Data Streams, you can choose between an on-demand capacity mode and a provisioned capacity mode for your data streams.
StreamMode (string) --
Specifies the capacity mode to which you want to set your data stream. Currently, in Kinesis Data Streams, you can choose between an on-demand capacity mode and a provisioned capacity mode for your data streams.
Shards (list) --
The shards that comprise the stream.
(dict) --
A uniquely identified group of data records in a Kinesis data stream.
ShardId (string) --
The unique identifier of the shard within the stream.
ParentShardId (string) --
The shard ID of the shard's parent.
AdjacentParentShardId (string) --
The shard ID of the shard adjacent to the shard's parent.
HashKeyRange (dict) --
The range of possible hash key values for the shard, which is a set of ordered contiguous positive integers.
StartingHashKey (string) --
The starting hash key of the hash key range.
EndingHashKey (string) --
The ending hash key of the hash key range.
SequenceNumberRange (dict) --
The range of possible sequence numbers for the shard.
StartingSequenceNumber (string) --
The starting sequence number for the range.
EndingSequenceNumber (string) --
The ending sequence number for the range. Shards that are in the OPEN state have an ending sequence number of null.
HasMoreShards (boolean) --
If set to true, more shards in the stream are available to describe.
RetentionPeriodHours (integer) --
The current retention period, in hours. Minimum value of 24. Maximum value of 168.
StreamCreationTimestamp (datetime) --
The approximate time that the stream was created.
EnhancedMonitoring (list) --
Represents the current enhanced monitoring settings of the stream.
(dict) --
Represents enhanced metrics types.
ShardLevelMetrics (list) --
List of shard-level metrics.
The following are the valid shard-level metrics. The value " ALL" enhances every metric.
IncomingBytes
IncomingRecords
OutgoingBytes
OutgoingRecords
WriteProvisionedThroughputExceeded
ReadProvisionedThroughputExceeded
IteratorAgeMilliseconds
ALL
For more information, see Monitoring the Amazon Kinesis Data Streams Service with Amazon CloudWatch in the Amazon Kinesis Data Streams Developer Guide.
(string) --
EncryptionType (string) --
The server-side encryption type used on the stream. This parameter can be one of the following values:
NONE: Do not encrypt the records in the stream.
KMS: Use server-side encryption on the records in the stream using a customer-managed Amazon Web Services KMS key.
KeyId (string) --
The GUID for the customer-managed Amazon Web Services KMS key to use for encryption. This value can be a globally unique identifier, a fully specified ARN to either an alias or a key, or an alias name prefixed by "alias/".You can also use a master key owned by Kinesis Data Streams by specifying the alias aws/kinesis.
Key ARN example: arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
Alias ARN example: arn:aws:kms:us-east-1:123456789012:alias/MyAliasName
Globally unique key ID example: 12345678-1234-1234-1234-123456789012
Alias name example: alias/MyAliasName
Master key owned by Kinesis Data Streams: alias/aws/kinesis
{'StreamDescriptionSummary': {'StreamModeDetails': {'StreamMode': 'PROVISIONED ' '| ' 'ON_DEMAND'}}}
Provides a summarized description of the specified Kinesis data stream without the shard list.
The information returned includes the stream name, Amazon Resource Name (ARN), status, record retention period, approximate creation time, monitoring, encryption details, and open shard count.
DescribeStreamSummary has a limit of 20 transactions per second per account.
See also: AWS API Documentation
Request Syntax
client.describe_stream_summary( StreamName='string' )
string
[REQUIRED]
The name of the stream to describe.
dict
Response Syntax
{ 'StreamDescriptionSummary': { 'StreamName': 'string', 'StreamARN': 'string', 'StreamStatus': 'CREATING'|'DELETING'|'ACTIVE'|'UPDATING', 'StreamModeDetails': { 'StreamMode': 'PROVISIONED'|'ON_DEMAND' }, 'RetentionPeriodHours': 123, 'StreamCreationTimestamp': datetime(2015, 1, 1), 'EnhancedMonitoring': [ { 'ShardLevelMetrics': [ 'IncomingBytes'|'IncomingRecords'|'OutgoingBytes'|'OutgoingRecords'|'WriteProvisionedThroughputExceeded'|'ReadProvisionedThroughputExceeded'|'IteratorAgeMilliseconds'|'ALL', ] }, ], 'EncryptionType': 'NONE'|'KMS', 'KeyId': 'string', 'OpenShardCount': 123, 'ConsumerCount': 123 } }
Response Structure
(dict) --
StreamDescriptionSummary (dict) --
A StreamDescriptionSummary containing information about the stream.
StreamName (string) --
The name of the stream being described.
StreamARN (string) --
The Amazon Resource Name (ARN) for the stream being described.
StreamStatus (string) --
The current status of the stream being described. The stream status is one of the following states:
CREATING - The stream is being created. Kinesis Data Streams immediately returns and sets StreamStatus to CREATING.
DELETING - The stream is being deleted. The specified stream is in the DELETING state until Kinesis Data Streams completes the deletion.
ACTIVE - The stream exists and is ready for read and write operations or deletion. You should perform read and write operations only on an ACTIVE stream.
UPDATING - Shards in the stream are being merged or split. Read and write operations continue to work while the stream is in the UPDATING state.
StreamModeDetails (dict) --
Specifies the capacity mode to which you want to set your data stream. Currently, in Kinesis Data Streams, you can choose between an on-demand ycapacity mode and a provisioned capacity mode for your data streams.
StreamMode (string) --
Specifies the capacity mode to which you want to set your data stream. Currently, in Kinesis Data Streams, you can choose between an on-demand capacity mode and a provisioned capacity mode for your data streams.
RetentionPeriodHours (integer) --
The current retention period, in hours.
StreamCreationTimestamp (datetime) --
The approximate time that the stream was created.
EnhancedMonitoring (list) --
Represents the current enhanced monitoring settings of the stream.
(dict) --
Represents enhanced metrics types.
ShardLevelMetrics (list) --
List of shard-level metrics.
The following are the valid shard-level metrics. The value " ALL" enhances every metric.
IncomingBytes
IncomingRecords
OutgoingBytes
OutgoingRecords
WriteProvisionedThroughputExceeded
ReadProvisionedThroughputExceeded
IteratorAgeMilliseconds
ALL
For more information, see Monitoring the Amazon Kinesis Data Streams Service with Amazon CloudWatch in the Amazon Kinesis Data Streams Developer Guide.
(string) --
EncryptionType (string) --
The encryption type used. This value is one of the following:
KMS
NONE
KeyId (string) --
The GUID for the customer-managed Amazon Web Services KMS key to use for encryption. This value can be a globally unique identifier, a fully specified ARN to either an alias or a key, or an alias name prefixed by "alias/".You can also use a master key owned by Kinesis Data Streams by specifying the alias aws/kinesis.
Key ARN example: arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
Alias ARN example: arn:aws:kms:us-east-1:123456789012:alias/MyAliasName
Globally unique key ID example: 12345678-1234-1234-1234-123456789012
Alias name example: alias/MyAliasName
Master key owned by Kinesis Data Streams: alias/aws/kinesis
OpenShardCount (integer) --
The number of open shards in the stream.
ConsumerCount (integer) --
The number of enhanced fan-out consumers registered with the stream.