Overview
Kinesis Data Streams collects and stores streaming data in real time.
The keyword to look for is real time.
Real-time data is created and used on the spot: website click streams, internet-connected devices (a connected bicycle), and metrics and logs from servers.
- Producers send data in: your own application code (SDK), or a Kinesis Agent installed on servers for metrics and logs.
- Consumers process it in real time: your own application code, Lambda, Amazon Data Firehose (10-Amazon-Data-Firehose), or analytics with Managed Service for Apache Flink.
Kinesis shards to consumers
Features
| Feature | Detail |
|---|---|
| Retention | Up to 365 days (1 to 365 days) |
| Replay | Data is persisted, so consumers can reprocess / replay it |
| Delete | Data cannot be deleted once sent. It must expire. |
| Record size | Up to 10 MiB (course said 1 MB), but the typical case is a lot of small real-time data |
| Ordering | Data with the same partition ID (key) is in order (same shard) |
| Encryption | At rest with KMS, in flight with HTTPS |
| Optimized producer | Kinesis Producer Library (KPL), for high throughput |
| Optimized consumer | Kinesis Client Library (KCL) |
Kinesis record size is up to 10 MiB (changed 2025-10). The course said 1 MB. The exam may still use the course figure. AWS source
Capacity Modes
| Provisioned | On-demand | |
|---|---|---|
| Setup | You choose the number of shards (from 1 up to 1,000 or more if you want) | No provisioning or capacity management |
| Write (per shard) | 1 MB/s or 1,000 records/s | Default capacity about 4,000 records/s or 4 MB in |
| Read (per shard) | 2 MB/s | |
| Scaling | Manual increase or decrease of shards. Monitor throughput to know how many you need. | Automatic, based on observed throughput during the past 30 days |
| Pricing | Pay per shard per hour | Pay per stream per hour plus data in and out |
A shard is basically how big your stream is. More shards means more throughput. Example: 10,000 records/s or 10 MB/s needs 10 shards.
Hands-On Walkthrough
Create the stream
- Open Kinesis. Options: Data Streams, Data Firehose, Data Analytics (now Amazon Managed Service for Apache Flink). Choose Data Streams.
- Pricing shown: $0.05 per hour per shard, plus a cost per PUT. There is no free tier, so you pay while the stream exists. Skip the demo if you do not want to spend money, and delete the stream quickly.
- Name it DemoStream.
- Capacity mode:
- On-demand: max throughput 10 GB/s write and 20 GB/s read in us-east-1, us-west-2 and eu-west-1 (200 MB/s write and 400 MB/s read in other Regions, as in the course) with enhanced fan-out. Pay-per-throughput, no free tier.
- Provisioned: use the shard estimator (records per second, record size, number of consumers). Choose 1 shard (1 MB/s write, 2 MB/s read, cheapest). 10 shards multiplies everything by 10.
- Click Create data stream.
Kinesis Data Analytics was renamed Amazon Managed Service for Apache Flink (2023-08). The course still uses the old name. AWS source
On-demand maximum is 10 GB/s write and 20 GB/s read in us-east-1, us-west-2 and eu-west-1 (2024-11). 200/400 MB/s applies only in other Regions. The course gave 200/400 MB/s. The exam may still use the course figure. AWS source
Console tour
- Producers recommended: Kinesis Agents, SDK (low-level producers), KPL (high-level, better API). All on GitHub.
- Consumers: Amazon Managed Service for Apache Flink (formerly Kinesis Data Analytics), Kinesis Data Firehose, Kinesis Client Library, and Lambda (not shown as an option).
- Monitoring shows records sent. Configuration lets you scale shards (for example 1 to 5), add tags and configure enhanced fan-out.
Produce and consume with CloudShell
- Open CloudShell (icon next to the bell). It is free and inherits your IAM credentials and the launch region (us-east-1). Check the CLI version with
aws --version. CloudShell has version 2, so use the v2 commands (the demo shows 2.1.16, as spoken). - Send a record with
aws kinesis put-record:--stream-name DemoStream,--partition-key user1,--data "user signup", and--cli-binary-format raw-in-base64-out(needed for text data). Data with the same partition key goes to the same shard (only one here). - The response shows
shardId-0000…(the first shard) and a sequence number. Repeat with user login and user logout. CloudWatch metrics (PutRecord) take a while to show. - Consume: run
describe-streamto find the shard (shardId-0000…(the first shard)). With the CLI or low-level SDK you must specify the shard; the KCL handles this for you. - Request a ShardIterator with
--shard-iterator-type TRIM-HORIZON(as spoken in the transcript), which reads from the very beginning of the stream. The other option reads only records from that moment onwards.. - Run
kinesis get-records --shard-iterator <value>. Records showPartitionKey user1, timestamps and base64-encoded data. Decoding with a base64 website gives the original text (user signup, user login). - The response includes a NextShardIterator, which you use to continue where you stopped. Your code must iterate over it.
This low-level flow is the shared consumption mode (not enhanced fan-out). Keep the stream open for 10-Amazon-Data-Firehose.
Questions & Answers
Q1: Which keyword points to Kinesis Data Streams?
Answer:
Real time streaming data.
Q2: How long can data stay in a stream, and can you delete it?
Answer:
Up to 365 days. You cannot delete data; it has to expire. Data can be replayed.
Q3: How do you guarantee order for related records?
Answer:
Use the same partition key. Ordering is at the shard level.
Q4: How many shards for 10 MB/s of writes?
Answer:
10 shards in provisioned mode (1 MB/s or 1,000 records/s each).
Q5: Provisioned or on-demand?
Answer:
Provisioned: you pick and scale shards, pay per shard hour. On-demand: automatic scaling based on the past 30 days, pay per stream hour and data volume.
Q6: Which libraries are used for producers and consumers?
Answer:
KPL for optimized high-throughput producers, KCL for optimized consumers. Compare services in 11-SQS-vs-SNS-vs-Kinesis.
Check yourself
Quiz
Flashcards
Click the card (or focus it), then use ← → to move and Space to flip.