describe_stream

describe_stream(**kwargs)

Describes the specified Kinesis data stream.

Note

This API has been revised. It's highly recommended that you use the DescribeStreamSummary API to get a summarized description of the specified Kinesis data stream and the ListShards API to list the shards in a specified data stream and obtain information about each shard.

Note

When invoking this API, it is recommended you use the StreamARN input parameter rather than the StreamName input parameter.

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

response = client.describe_stream(
    StreamName='string',
    Limit=123,
    ExclusiveStartShardId='string',
    StreamARN='string'
)
Parameters
  • StreamName (string) -- The name of the stream to describe.
  • Limit (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.
  • ExclusiveStartShardId (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.

  • StreamARN (string) -- The ARN of the stream.
Return type

dict

Returns

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

Exceptions

  • Kinesis.Client.exceptions.ResourceNotFoundException
  • Kinesis.Client.exceptions.LimitExceededException
  • Kinesis.Client.exceptions.InvalidArgumentException
  • Kinesis.Client.exceptions.AccessDeniedException