Menu
Amazon Kinesis Streams
Developer Guide

Producers for Amazon Kinesis Streams

A producer puts data records into Amazon Kinesis streams. For example, a web server sending log data to an Amazon Kinesis stream is a producer. A consumer processes the data records from a stream.

Important

Data records are accessible for a default of 24 hours from the time they are added to a stream. This time frame is called the retention period and is configurable in hourly increments from 24 to 168 hours (1 to 7 days). For more information about the stream retention period, see Changing the Data Retention Period.

To put data into the stream, you must specify the name of the stream, a partition key, and the data blob to be added to the stream. The partition key is used to determine which shard in the stream the data record is added to.

All the data in the shard is sent to the same worker that is processing the shard. Which partition key you use depends on your application logic. The number of partition keys should typically be much greater than the number of shards. This is because the partition key is used to determine how to map a data record to a particular shard. If you have enough partition keys, the data can be evenly distributed across the shards in a stream.

For more information, see Adding Data to a Stream (includes Java example code), the PutRecords and PutRecord operations in the Streams API, or the put-record command.