aws-kinesis-0.1.3: Bindings for Amazon Kinesis

CopyrightCopyright (c) 2013-2014 PivotCloud, Inc.
LicenseApache License, Version 2.0
MaintainerLars Kuhtz <>
Safe HaskellNone



API Version: 2013-12-02

The Amazon Kinesis Service API Reference API contains several data types that various actions use.



data StreamName Source

Stream Name

The stream name is scoped to the AWS account used by the application that creates the stream. It is also scoped by region. That is, two streams in two different AWS accounts can have the same name, and two streams in the same AWS account, but in two different regions, can have the same name.

Length constraints: Minimum length of 1. Maximum length of 128.

Error responses from AWS Kinesis indicate that stream names must match the following regular expressions:


streamName :: Text -> Either Text StreamName Source

Smart Constructor for StreamName that enforces size constraints.

For static construction you may also use the IsString instance that throws an error on invalid stream names.

data ShardId Source

Identifier for a shard as returned by PutRecord.

Length constraints: Minimum length of 1. Maximum length of 128.

data PartitionHash Source

An 128 bit interger that identifies the partition. The default is the MD5 hash of the partition key.

FIXME the specification is rather vague about the precise encoding of this value. The default is to compute it as an MD5 hash of the partition key. The API reference describes it as an Int128. However, it is not clear how the result of the hash function is encoded (big-endian or small endian, word size?) and how it is serialized to text, which is the type in the JSON serialization. seems to indicate that the value is actually unsigned.

partitionHash :: Integer -> Either Text PartitionHash Source

Smart Constructor for PartitionHash that enforces size constraints.

data PartitionKey Source


Identifies which shard in the stream the data record is assigned to.

Partition keys are Unicode strings with a maximum length limit of 256 bytes. Amazon Kinesis uses the partition key as input to a hash function that maps the partition key and associated data to a specific shard. Specifically, an MD5 hash function is used to map partition keys to 128-bit integer values and to map associated data records to shards. As a result of this hashing mechanism, all data records with the same partition key will map to the same shard within the stream.

Length constraints: Minimum length of 1. Maximum length of 256.

data ShardIterator Source

Iterator for records within a shard.

Length constraints: Minimum length of 1. Maximum length of 512.

data ShardIteratorType Source


Determines how the shard iterator is used to start reading data records from the shard.



Start reading exactly from the position denoted by a specific sequence number.


Start reading right after the position denoted by a specific sequence number.


Start reading at the last untrimmed record in the shard in the system, which is the oldest data record in the shard.


Start reading just after the most recent record in the shard, so that you always read the most recent data in the shard.

data Record Source


The unit of data of the Amazon Kinesis stream, which is composed of a sequence number, a partition key, and a data blob.




recordData :: !ByteString

The data blob. The data in the blob is both opaque and immutable to the Amazon Kinesis service, which does not inspect, interpret, or change the data in the blob in any way. The maximum size of the data blob (the payload after Base64-decoding) is 50 kilobytes (KB)

Length constraints: Minimum length of 0. Maximum length of 51200.

Note that the size constraint is not currently enforced in the code.

recordPartitionKey :: !PartitionKey

Identifies which shard in the stream the data record is assigned to.

recordSequenceNumber :: !SequenceNumber

The unique identifier for the record in the Amazon Kinesis stream.

data StreamDescription Source




streamDescriptionHasMoreShards :: !Bool

If set to true there are more shards in the stream available to describe.

streamDescriptionShards :: ![Shard]

The shards that comprise the stream.

streamDescriptionStreamARN :: !Arn

The Amazon Resource Name (ARN) for the stream being described.

streamDescriptionStreamName :: !StreamName

The name of the stream being described.

streamDescriptionStreamStatus :: !StreamStatus

The current status of the stream being described.

data StreamStatus Source



The stream is being created. Upon receiving a CreateStream request, Amazon Kinesis immediately returns and sets StreamStatus to CREATING.


The stream is being deleted. After a DeleteStream request, the specified stream is in the DELETING state until Amazon Kinesis completes the deletion.


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.


Shards in the stream are being merged or split. Read and write operations continue to work while the stream is in the UPDATING state.

data Shard Source




shardAdjacentParentShardId :: !(Maybe ShardId)

The shard Id of the shard adjacent to the shard's parent.

shardHashKeyRange :: !(PartitionHash, PartitionHash)

The (inclusive) range of possible hash key values for the shard, which is a set of ordered contiguous positive integers.

shardParentShardId :: !(Maybe ShardId)

The shard Id of the shard's parent.

shardSequenceNumberRange :: !(SequenceNumber, Maybe SequenceNumber)

The (inclusive) range of possible sequence numbers for the shard.

Shards that are in the OPEN state have an ending sequence number of Nothing.

shardShardId :: ShardId

The unique identifier of the shard within the Amazon Kinesis stream.