DescribeStreamCommand

Describes the specified Kinesis data stream.

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.

When invoking this API, you must use either the StreamARN or the StreamName parameter, or both. It is recommended that you use the StreamARN input parameter when you invoke this API.

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.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { KinesisClient, DescribeStreamCommand } from "@aws-sdk/client-kinesis"; // ES Modules import
// const { KinesisClient, DescribeStreamCommand } = require("@aws-sdk/client-kinesis"); // CommonJS import
const client = new KinesisClient(config);
const input = { // DescribeStreamInput
  StreamName: "STRING_VALUE",
  Limit: Number("int"),
  ExclusiveStartShardId: "STRING_VALUE",
  StreamARN: "STRING_VALUE",
};
const command = new DescribeStreamCommand(input);
const response = await client.send(command);
// { // DescribeStreamOutput
//   StreamDescription: { // StreamDescription
//     StreamName: "STRING_VALUE", // required
//     StreamARN: "STRING_VALUE", // required
//     StreamStatus: "CREATING" || "DELETING" || "ACTIVE" || "UPDATING", // required
//     StreamModeDetails: { // StreamModeDetails
//       StreamMode: "PROVISIONED" || "ON_DEMAND", // required
//     },
//     Shards: [ // ShardList // required
//       { // Shard
//         ShardId: "STRING_VALUE", // required
//         ParentShardId: "STRING_VALUE",
//         AdjacentParentShardId: "STRING_VALUE",
//         HashKeyRange: { // HashKeyRange
//           StartingHashKey: "STRING_VALUE", // required
//           EndingHashKey: "STRING_VALUE", // required
//         },
//         SequenceNumberRange: { // SequenceNumberRange
//           StartingSequenceNumber: "STRING_VALUE", // required
//           EndingSequenceNumber: "STRING_VALUE",
//         },
//       },
//     ],
//     HasMoreShards: true || false, // required
//     RetentionPeriodHours: Number("int"), // required
//     StreamCreationTimestamp: new Date("TIMESTAMP"), // required
//     EnhancedMonitoring: [ // EnhancedMonitoringList // required
//       { // EnhancedMetrics
//         ShardLevelMetrics: [ // MetricsNameList
//           "IncomingBytes" || "IncomingRecords" || "OutgoingBytes" || "OutgoingRecords" || "WriteProvisionedThroughputExceeded" || "ReadProvisionedThroughputExceeded" || "IteratorAgeMilliseconds" || "ALL",
//         ],
//       },
//     ],
//     EncryptionType: "NONE" || "KMS",
//     KeyId: "STRING_VALUE",
//   },
// };

DescribeStreamCommand Input

See DescribeStreamCommandInput for more details

Parameter
Type
Description
ExclusiveStartShardId
string | undefined

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.

Limit
number | undefined

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.

StreamARN
string | undefined

The ARN of the stream.

StreamName
string | undefined

The name of the stream to describe.

DescribeStreamCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
StreamDescription
Required
StreamDescription | undefined

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.

Throws

Name
Fault
Details
AccessDeniedException
client

Specifies that you do not have the permissions required to perform this operation.

InvalidArgumentException
client

A specified parameter exceeds its restrictions, is not supported, or can't be used. For more information, see the returned message.

LimitExceededException
client

The requested resource exceeds the maximum number allowed, or the number of concurrent stream requests exceeds the maximum number allowed.

ResourceNotFoundException
client

The requested resource could not be found. The stream might not be specified correctly.

KinesisServiceException
Base exception class for all service exceptions from Kinesis service.