Kinesis / Client / update_stream_record_distribution_strategy

update_stream_record_distribution_strategy

Kinesis.Client.update_stream_record_distribution_strategy(**kwargs)

Updates the record distribution strategy for the specified Amazon Kinesis Data Streams on-demand data stream. The record distribution strategy determines how Amazon Kinesis Data Streams distributes records across the shards in a stream.

Note

You must specify the stream using the StreamARN parameter.

The record distribution strategy is a stream-level setting. You can switch between the following strategies at any time, and the change takes effect immediately without downtime, data loss, or disruption to producer or consumer applications:

  • AUTO – Amazon Kinesis Data Streams distributes records evenly across shards using service-managed algorithms, and ignores any partition key and ExplicitHashKey that a producer provides. Use this strategy for stateless workloads that do not require partition-key ordering.

  • USER_PARTITION_KEY – Producers must provide a partition key, and Amazon Kinesis Data Streams uses the partition key to determine shard placement. Records that share a partition key are sent to the same shard. This is the default strategy.

This operation is only supported for data streams that use the on-demand capacity mode. Provisioned capacity mode streams do not support the record distribution strategy setting. Attempting to set AUTO on a provisioned stream results in an InvalidArgumentException.

New records that arrive after the change are distributed according to the new strategy. Records already in the stream keep their original shard assignments and are not redistributed.

See also: AWS API Documentation

Request Syntax

response = client.update_stream_record_distribution_strategy(
    StreamARN='string',
    StreamId='string',
    RecordDistributionStrategy='AUTO'|'USER_PARTITION_KEY'
)
Parameters:
  • StreamARN (string) –

    [REQUIRED]

    The Amazon Resource Name (ARN) of the stream to update.

  • StreamId (string) – Not Implemented. Reserved for future use.

  • RecordDistributionStrategy (string) –

    [REQUIRED]

    The record distribution strategy to apply to the stream. Specify one of the following values:

    • AUTO – Amazon Kinesis Data Streams distributes records evenly across shards and ignores any partition key and ExplicitHashKey that producers supply.

    • USER_PARTITION_KEY – Producers must supply a partition key, which Amazon Kinesis Data Streams uses to determine shard placement. This is the default.

Returns:

None

Exceptions

  • Kinesis.Client.exceptions.ResourceNotFoundException

  • Kinesis.Client.exceptions.InvalidArgumentException

  • Kinesis.Client.exceptions.ResourceInUseException

  • Kinesis.Client.exceptions.LimitExceededException

  • Kinesis.Client.exceptions.AccessDeniedException

  • Kinesis.Client.exceptions.ValidationException