Supercharging Kinesis CLI: Introducing kines put, KPL Deaggregation, and Clean jq Piping
// TABLE_OF_CONTENTS(5 sections) ▼
Anyone who has worked with Amazon Kinesis Data Streams knows the pain of debugging records with the official AWS CLI. Inspecting a stream usually means juggling shard IDs, generating shard iterators, manually decoding base64 payloads, copying NextShardIterator tokens, and writing throwaway Bash loops.
I originally built kines to make Kinesis streams human-friendly in the terminal.
Over the past few weeks, we released two major updates—v1.2.0 and v1.3.0—addressing long-standing community requests and making kines a complete read/write toolkit for stream debugging.
Here is what’s new.
1. Ingesting Records with kines put
Previously, kines was primarily a reading and inspection tool. If you wanted to push sample payloads to test downstream consumers or lambdas, you had to write a Python script or wrestle with aws kinesis put-record.
With kines put, you can now push records directly from your command line.
Single Record Ingestion
kines put order-stream -p user-101 -d '{"event": "checkout", "total": 49.99}'
(If -p/--partition-key is omitted, a random UUID is generated automatically).
File Ingestion
You can also pass raw payload files or JSON arrays:
kines put order-stream -f payload.json
2. Built-in KPL Record Aggregation & Transparent Deaggregation
Many high-throughput production systems use the Kinesis Producer Library (KPL) to aggregate multiple user records into a single Kinesis record to maximize throughput and minimize cost.
The problem? Aggregated records are packed with Protobuf binaries and a magic byte header (0xF3899AC2). Trying to read them with conventional tools produces garbled binary output or base64 decoding errors (binascii.Error: Incorrect padding).
Publishing Aggregated Records
With the -a flag, kines bundles multiple records into a KPL-compatible aggregated payload using aws-kinesis-agg:
kines put telemetry-stream -a \
-p sensor-1 -d '{"temp": 22.4}' \
-p sensor-2 -d '{"humidity": 65.0}'
Transparent Deaggregation in kines walk
When walking records, kines now automatically detects KPL payloads, unpacks them on the fly, and presents each user record individually with its sub-sequence number:
kines walk telemetry-stream 000000000000
3. Piping Directly to jq with --raw
kines walk renders a clean ASCII table with metadata (timestamps, partition keys, shard IDs). While great for visual inspection, developers frequently requested an easy way to pipe payloads directly to utilities like jq without scraping table borders.
In v1.3.0, we added -r / --raw:
kines walk order-stream 000000000000 -r | jq .
To make sure pipes don’t break:
- Decoded payloads are emitted cleanly to
stdout. - Interactive prompts (
Fetch more records? [Y/n]:) and status messages are routed tostderr.
You can also combine --raw with -f (follow mode) to stream live events straight into jq:
kines walk order-stream 000000000000 -r -f | jq 'select(.total > 100)'
4. Fast Local Integration Testing with aws-emulator
To test live stream operations (creating streams, putting records, KPL aggregation, deaggregation, and walking shards) without incurring AWS costs or managing disposable cloud infrastructure, the kines repository now runs full integration tests against aws-emulator.
Because aws-emulator starts up in under a second and provides native TLS certificates and credential files, our GitHub Actions CI matrix (spanning Python 3.10 through 3.13) tests real boto3 socket calls on every commit in just ~15 seconds.
Getting Started
You can upgrade or install the latest release directly from PyPI:
pip install --upgrade kines
Check out the project and docs on GitHub:
👉 github.com/dinsaw/kines
Feedback, feature requests, and PRs are always welcome!