Amazon Kinesis

2015/10/06 - Amazon Kinesis - 2 new 1 updated api methods

DecreaseStreamRetentionPeriod (new) Link ¶

Decreases the stream's retention period, which is the length of time data records are accessible after they are added to the stream. The minimum value of a stream’s retention period is 24 hours.

This operation may result in lost data. For example, if the stream's retention period is 48 hours and is decreased to 24 hours, any data already in the stream that is older than 24 hours is inaccessible.

Request Syntax

client.decrease_stream_retention_period(
    StreamName='string',
    RetentionPeriodHours=123
)
type StreamName

string

param StreamName

[REQUIRED]

The name of the stream to modify.

type RetentionPeriodHours

integer

param RetentionPeriodHours

[REQUIRED]

The new retention period of the stream, in hours. Must be less than the current retention period.

returns

None

IncreaseStreamRetentionPeriod (new) Link ¶

Increases the stream's retention period, which is the length of time data records are accessible after they are added to the stream. The maximum value of a stream’s retention period is 168 hours (7 days).

Upon choosing a longer stream retention period, this operation will increase the time period records are accessible that have not yet expired. However, it will not make previous data that has expired (older than the stream’s previous retention period) accessible after the operation has been called. For example, if a stream’s retention period is set to 24 hours and is increased to 168 hours, any data that is older than 24 hours will remain inaccessible to consumer applications.

Request Syntax

client.increase_stream_retention_period(
    StreamName='string',
    RetentionPeriodHours=123
)
type StreamName

string

param StreamName

[REQUIRED]

The name of the stream to modify.

type RetentionPeriodHours

integer

param RetentionPeriodHours

[REQUIRED]

The new retention period of the stream, in hours. Must be more than the current retention period.

returns

None

DescribeStream (updated) Link ¶
Changes (response)
{'StreamDescription': {'RetentionPeriodHours': 'integer'}}

Describes the specified stream.

The information about the stream includes its current status, its Amazon Resource Name (ARN), and an array of shard objects. For each shard object, there is information about 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. A sequence number is the identifier associated with every record ingested in the Amazon Kinesis stream. The sequence number is assigned when a record is put into the stream.

You can limit the number of returned shards using the Limit parameter. The number of shards in a stream may be too large to return from a single call to DescribeStream . You can detect this by using the HasMoreShards flag in the returned output. HasMoreShards is set to true when there is more data available.

DescribeStream is a paginated operation. If there are more shards available, you can request them using the shard ID of the last shard returned. Specify this ID in the ExclusiveStartShardId parameter in a subsequent request to DescribeStream .

DescribeStream has a limit of 10 transactions per second per account.

Request Syntax

client.describe_stream(
    StreamName='string',
    Limit=123,
    ExclusiveStartShardId='string'
)
type StreamName

string

param StreamName

[REQUIRED]

The name of the stream to describe.

type Limit

integer

param Limit

The maximum number of shards to return.

type ExclusiveStartShardId

string

param ExclusiveStartShardId

The shard ID of the shard to start with.

rtype

dict

returns

Response Syntax

{
    'StreamDescription': {
        'StreamName': 'string',
        'StreamARN': 'string',
        'StreamStatus': 'CREATING'|'DELETING'|'ACTIVE'|'UPDATING',
        'Shards': [
            {
                'ShardId': 'string',
                'ParentShardId': 'string',
                'AdjacentParentShardId': 'string',
                'HashKeyRange': {
                    'StartingHashKey': 'string',
                    'EndingHashKey': 'string'
                },
                'SequenceNumberRange': {
                    'StartingSequenceNumber': 'string',
                    'EndingSequenceNumber': 'string'
                }
            },
        ],
        'HasMoreShards': True|False,
        'RetentionPeriodHours': 123
    }
}

Response Structure

  • (dict) --

    Represents the output for DescribeStream .

    • StreamDescription (dict) --

      The current status of the stream, the stream ARN, an array of shard objects that comprise the stream, and states 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. Amazon Kinesis immediately returns and sets StreamStatus to CREATING .

        • DELETING - The stream is being deleted. The specified stream is in the DELETING state until Amazon Kinesis 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.

      • Shards (list) --

        The shards that comprise the stream.

        • (dict) --

          A uniquely identified group of data records in an Amazon Kinesis stream.

          • ShardId (string) --

            The unique identifier of the shard within the Amazon Kinesis 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.