What Is Amazon Kinesis? Streaming Data on AWS Explained
Batch jobs wait for a file at midnight. Streaming apps react as events happen: clicks, GPS pings, payments. Amazon Kinesis is a family of services for ingesting and processing streaming data on AWS — pipes that never sleep.
In this chapter
- Why streaming vs batch
- Data Streams vs Firehose vs Data Analytics
- Shards, producers, consumers
- When to pick MSK or SQS instead
- Lab, errors, FAQ, interview
1. Everyday example first
A cab app in Hyderabad emits location every few seconds. You cannot wait for nightly CSV. Producers write to a Kinesis data stream; consumers update ETAs and fraud checks in near real time. Firehose can also archive raw events to S3 for later Athena.
2. Why Kinesis?
Queues (SQS) are great for work tickets. Streams keep ordered records for multiple consumers over a retention window. Analytics and dashboards need that firehose of events.
3. What is in the Kinesis family?
A stream is an ordered flow of records that can be retained for a time. Imagine a scooter app sends one location record every few seconds. A producer writes each record, and a consumer reads it to update a map. Another consumer can read the same stream for reporting. Amazon Data Firehose can deliver streaming data to a destination such as S3. Amazon Managed Service for Apache Flink can run a streaming computation such as a count over the last minute. Draw who writes, who reads and which result each service provides.
| Service | Plain job |
|---|---|
| Data Streams | Durable real-time stream with shards |
| Data Firehose | Load streams to S3/Redshift/OpenSearch with batching |
| Data Analytics / Flink | SQL/Flink processing on streams |
4. How shards work (simple)
Use the scooter ID as the partition key and draw three consecutive records for scooter A and two for scooter B. A shard is one ordered part of the stream. The key helps place records in shards, which lets consumers reason about order within a shard rather than expecting one order across all scooters. Imagine the map consumer stops for a minute but the stream retains the records for longer. When it returns, it can read retained records from an appropriate position and catch up. Check how old the data it is reading is to see whether it is falling behind.
- A stream is split into shards; each shard has throughput limits.
- Partition key chooses the shard (e.g., rider_id).
- Consumers use iterators or enhanced fan-out.
- Scale shards when throttled (or use on-demand mode).
- Set retention (hours to days) for replay.
- Monitor IteratorAge — lagging consumers.
# Producer sketch (boto3 mental model)
# kinesis.put_record(
# StreamName='rides',
# Data=b'{"rider":"R1","lat":17.4}',
# PartitionKey='R1')
5. Kinesis vs MSK vs SQS
| Choice | When |
|---|---|
| Kinesis Data Streams | AWS-native streaming, simple ops |
| Amazon MSK | Need Kafka ecosystem/tools |
| SQS | Task queue, competing consumers, no long replay |
6. Industries
- Mobility: GPS + ETA
- Fintech: payment event pipelines
- IoT factories: sensor telemetry
- Media: clickstream personalization
7. Lab: paper design + console click-tour
List eight sample events from two devices. Mark their keys, draw a possible shard layout and follow the records read by two consumers. In your scenario, stop one consumer before the last few records. Mark what the healthy one sees and what the stopped one has to replay. The intended result is separate progress for the two readers while retained records remain available to both.
Do this in ap-south-1 (Mumbai) unless your org forbids it. Set a budget alert first.
- Define three event fields for a sample clickstream.
- Choose partition key and explain hot-shard risk.
- Decide Firehose vs custom consumer for S3 archive.
- In console, open Kinesis and note on-demand vs provisioned.
- Write alarm idea: IteratorAge > 60s.
Cleanup (stop billing)
- Delete any lab stream you created.
- Stop Firehose delivery streams to halt S3 put costs.
8. Common errors and fixes
Each row is a real mistake students and juniors hit. Read the fix before you panic.
| Error / symptom | Fix |
|---|---|
| Hot shard from bad partition key | High-cardinality keys; avoid status=OK. |
| Consumer lag ignored | Alarm on IteratorAge. |
| PutRecord over 1MB | Split or compress carefully. |
| Firehose dynamic partitioning misconfig | Test prefixes; monitor failures. |
| Retained data but no replay plan | Document who replays how. |
| Used SQS but needed multiple replayable consumers | Pick a stream. |
| No encryption | Enable SSE (KMS). |
| Provisioned mode under-scaled | On-demand or reshard. |
| PII in cleartext events | Tokenize; encrypt fields. |
| Lambda consumer timeout loops | Batch size + bisect on error. |
9. Troubleshooting checklist
- ProvisionedThroughputExceeded → scale or on-demand.
- AccessDenied on put → IAM kinesis:PutRecord.
- Empty consumers → check iterator / subscription.
- Firehose to S3 403 → bucket policy + role.
- Wrong region stream name.
- Clock skew on producers → NTP.
10. FAQ
Q. Is Kinesis Kafka?
Different product; MSK is Kafka. Kinesis is AWS-native streaming.
Q. Firehose without Streams?
Firehose can ingest directly from many sources.
Q. How long is data kept?
Configurable retention on streams.
Q. Exactly-once?
Plan for at-least-once; make consumers idempotent.
Q. Cost control tip?
On-demand carefully; compress; sample debug streams.
11. Interview Q&A
Q. What is a shard?
A throughput unit inside a data stream.
Q. Partition key purpose?
Routes records to shards; keep cardinality healthy.
Q. Streams vs Firehose?
Streams=raw durable stream; Firehose=managed delivery.
Q. IteratorAge?
How late consumers are.
Q. When MSK?
Need Kafka APIs/ecosystem.
Q. Idempotent consumer?
Same record twice does not double-apply.
12. Tips in English, Marathi and Hindi
Ravindra Bagale's Tip (EN)
Pick the partition key with a whiteboard, not with a coin flip. Hot shards wake you at 3 AM.
Ravindra Bagale's Tip (MR)
Partition key whiteboard वर ठरवा. Hot shards रात्री उठवतात.
Tip (HI)
Partition key व्हाइटबोर्ड पर चुनो — hot shards रात में जगाते हैं।
Try at home
- List five events your phone apps probably stream.
- Compare SQS vs Kinesis in five bullets.
- Sketch producer → stream → Lambda → DynamoDB.
In short
- Kinesis moves streaming data on AWS.
- Streams vs Firehose vs Analytics = ingest vs load vs process.
- Shards + partition keys decide scale and hotspots.
- Prefer idempotent consumers; watch IteratorAge.
Revision, interview and comparison cards
Revise this lesson in a few minutes. Save the cards on your phone or download them as PNG files. The QR code on each card opens this lesson.











More cards: Ravi Sir's Cards.
Practise this chapter
Interview questions and answers
Two consumers read one stream. One falls behind. What happens to the other reader?
Each consumer can track its own progress, so the healthy reader can continue independently. The delayed reader can recover retained records from a suitable position within retention. Check how old its read position is and whether the retention window still contains what it missed.
Check your understanding
Choose an answer, then compare your reasoning with the explanation.
Practice Tasks
Practice checks run in your browser. They check the answer for this exercise; they do not create resources or connect to your AWS account.
About this scenarioNairobi Ride is a transport business in Nairobi. Wanjiru Kamau looks after its IT and cloud work. They count money in KES and run their AWS resources in the af-south-1 Region. In the tasks below you do real jobs for them using what this lesson teaches. All names, account IDs, IP addresses and numbers are made up for practice.
0 / 16
Easy List streams
See data streams.
List Kinesis streams.
- Read the task and decide which AWS service it is about.
- Write aws, then the service name, then the operation (the action word).
- Add each needed flag (--name) followed by its value from the task.
- Flags can be in any order. Click Check answer.
Easy Describe stream
Shard count.
Describe stream nairobiride-rides.
- Read the task and decide which AWS service it is about.
- Write aws, then the service name, then the operation (the action word).
- Add each needed flag (--name) followed by its value from the task.
- Flags can be in any order. Click Check answer.
Easy List delivery streams
Delivery inventory.
List Firehose delivery streams.
- Read the task and decide which AWS service it is about.
- Write aws, then the service name, then the operation (the action word).
- Add each needed flag (--name) followed by its value from the task.
- Flags can be in any order. Click Check answer.
Easy Apply the lesson: scenario 4
Two classic Kinesis shards each allow 1 MB/s of writes. Ignoring other limits, what total incoming MB/s do they provide? Enter the number.
- Read the situation and identify what you need to decide.
- Work through the relevant concept or calculation.
- Enter only the requested term or number.
- Check your answer, then read the explanation.
Easy SQS is not a stream — 0
Pick right tool.
Is SQS the same as a Kinesis stream? Enter 0 for no.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Easy Apply the lesson: scenario 6
Which put-record parameter determines partition-key-based placement in a Kinesis stream? Enter its CLI flag.
- Read the situation and identify what you need to decide.
- Work through the relevant concept or calculation.
- Enter only the requested term or number.
- Check your answer, then read the explanation.
Medium Put record
Producer write.
Put record on nairobiride-rides partition key R1 data file://e.json.
- Read the task and decide which AWS service it is about.
- Write aws, then the service name, then the operation (the action word).
- Add each needed flag (--name) followed by its value from the task.
- Flags can be in any order. Click Check answer.
Medium Describe delivery stream
Check destination.
Describe delivery stream nairobiride-to-s3.
- Read the task and decide which AWS service it is about.
- Write aws, then the service name, then the operation (the action word).
- Add each needed flag (--name) followed by its value from the task.
- Flags can be in any order. Click Check answer.
Medium Stream summary
Faster than full describe.
Describe stream summary nairobiride-rides.
- Read the task and decide which AWS service it is about.
- Write aws, then the service name, then the operation (the action word).
- Add each needed flag (--name) followed by its value from the task.
- Flags can be in any order. Click Check answer.
Medium GetRecords
Consumers.
Allow kinesis:GetRecords on arn:aws:kinesis:af-south-1:104591109902:stream/nairobiride-rides.
- Start with { "Version": "2012-10-17", "Statement": [ ... ] }.
- In each statement write Effect, Action and Resource.
- Give only what the task needs (least privilege).
- Use double quotes and commas correctly. Click Check answer.
Medium Event JSON
Sample payload.
JSON rider R1 lat 17.4.
- Start from the top-level keys the task names.
- Indent child keys with 2 spaces (no tabs).
- Fill in each property with the value from the task.
- Click Check answer. Key order does not matter.
Medium IteratorAge alarm seconds sample
Lag alarm.
Sample IteratorAge alarm threshold seconds (enter 60)?
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Hard List shards
Inspect hotspots.
List shards on nairobiride-rides.
- Read the task and decide which AWS service it is about.
- Write aws, then the service name, then the operation (the action word).
- Add each needed flag (--name) followed by its value from the task.
- Flags can be in any order. Click Check answer.
Hard Delete stream
Stop lab cost.
Delete stream nairobiride-lab.
- Read the task and decide which AWS service it is about.
- Write aws, then the service name, then the operation (the action word).
- Add each needed flag (--name) followed by its value from the task.
- Flags can be in any order. Click Check answer.
Hard PutRecord on one stream
Producers scoped.
Allow kinesis:PutRecord on arn:aws:kinesis:af-south-1:104591109902:stream/nairobiride-rides.
- Start with { "Version": "2012-10-17", "Statement": [ ... ] }.
- In each statement write Effect, Action and Resource.
- Give only what the task needs (least privilege).
- Use double quotes and commas correctly. Click Check answer.
Hard Retention hours JSON
Replay window.
JSON RetentionHours 24.
- Start from the top-level keys the task names.
- Indent child keys with 2 spaces (no tabs).
- Fill in each property with the value from the task.
- Click Check answer. Key order does not matter.