1
votes

How do I write data to a specific shard in Kinesis?

The Boto docs say

Partition keys are Unicode strings, with a maximum length limit of 256 characters for each key. An MD5 hash function is used to map partition keys to 128-bit integer values and to map associated data records to shards using the hash key ranges of the shards. You can override hashing the partition key to determine the shard by explicitly specifying a hash value using the ExplicitHashKey parameter.

However how do I actually do this?

1

1 Answers

0
votes

The way to do this is to set the ExplicitHashKey to a value between the specific shard's EndingHashKey and StartingHashKey or just setting it to one of those.

put_response = kinesis_client.put_record(
                    StreamName=my_stream_name,
                    Data=json.dumps(payload),
                    ExplicitHashKey='340282366920938463463374607431768211455',
                    PartitionKey=thing_id)