Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions,
see Getting Started with Amazon Web Services in China
(PDF).
Use DescribeStreamSummary with an Amazon SDK or CLI
The following code examples show how to use DescribeStreamSummary.
Action examples are code excerpts from larger programs and must be run in context. You can see this action in
context in the following code example:
- CLI
-
- Amazon CLI
-
To describe a data stream summary
The following describe-stream-summary example provides a summarized description (without the shard list) of the specified data stream.
aws kinesis describe-stream-summary \
--stream-name samplestream
Output:
{
"StreamDescriptionSummary": {
"StreamName": "samplestream",
"StreamARN": "arn:aws:kinesis:us-west-2:123456789012:stream/samplestream",
"StreamStatus": "ACTIVE",
"RetentionPeriodHours": 48,
"StreamCreationTimestamp": 1572297168.0,
"EnhancedMonitoring": [
{
"ShardLevelMetrics": []
}
],
"EncryptionType": "NONE",
"OpenShardCount": 3,
"ConsumerCount": 0
}
}
For more information, see Creating and Managing Streams in the Amazon Kinesis Data Streams Developer Guide.
- Python
-
- SDK for Python (Boto3)
-
def describe_stream_summary(self, stream_name):
"""
Provides a summarized description of a Kinesis data stream.
:param stream_name: The name of the stream to describe.
:return: A dictionary containing the stream description summary.
"""
try:
response = self.kinesis_client.describe_stream_summary(
StreamName=stream_name
)
summary = response.get("StreamDescriptionSummary", dict())
logger.info(
"Described stream summary for '%s'. Status: %s.",
stream_name,
summary.get("StreamStatus", "UNKNOWN"),
)
return summary
except ClientError as err:
if err.response["Error"]["Code"] == "ResourceNotFoundException":
logger.error(
"Stream '%s' not found. Verify the stream name.", stream_name
)
raise
For a complete list of Amazon SDK developer guides and code examples, see
Using this service with an Amazon SDK.
This topic also includes information about getting started and details about previous SDK versions.