Durable, ordered, replayable stream (shards); you write consumers
Amazon Data Firehose
Fully managed delivery: buffers a stream and writes it to S3, Redshift, OpenSearch, Iceberg tables, Splunk or HTTP endpoints
Managed Service for Apache Flink
Stateful stream processing (SQL, Java, Python) on Kinesis or MSK
2. Kinesis Data Streams
Concept
Detail
Shard
Unit of capacity: up to 1 MB/s or 1,000 records/s in, 2 MB/s out (shared by standard consumers)
Partition key
Hashed to choose the shard; records with the same key stay ordered
Sequence number
Unique, increasing per shard; consumers checkpoint by it
Retention
24 hours by default, extendable up to 365 days
Capacity modes
On-demand (scales automatically) or provisioned (you choose shards and reshard)
Enhanced fan-out
Dedicated 2 MB/s per consumer per shard with push delivery and lower latency
import json, boto3
kinesis = boto3.client("kinesis")
def send(events: list[dict]) -> None:
records = [{"Data": json.dumps(e).encode(), "PartitionKey": e["account_id"]} for e in events]
for i in range(0, len(records), 500): # PutRecords takes up to 500 records
batch = records[i:i + 500]
resp = kinesis.put_records(StreamName="txn-events", Records=batch)
if resp["FailedRecordCount"]: # partial failures do not raise
retry = [r for r, res in zip(batch, resp["Records"]) if "ErrorCode" in res]
kinesis.put_records(StreamName="txn-events", Records=retry) # retry with backoff in real code
Consumer option
Notes
Lambda event source mapping
Simplest; batch size, parallelization factor (up to 10 batches per shard), bisect on error
Kinesis Client Library (KCL)
Java (and multi-language) library; leases and checkpoints in a DynamoDB table
Managed Service for Apache Flink
Windows, joins, state and exactly-once processing
Spark Structured Streaming / Glue streaming
Micro-batch processing into the lake
Firehose
No-code delivery to storage
Starting positions: TRIM_HORIZON (oldest available), LATEST, AT_TIMESTAMP, or AT_SEQUENCE_NUMBER. Replay by starting a consumer from an earlier position.
3. Amazon Data Firehose
Firehose buffers incoming records (by size or time) and writes batches to the destination, with optional Lambda transformation, format conversion to Parquet/ORC (using a Glue table schema), and dynamic partitioning based on record content: