Skip to content

Instantly share code, notes, and snippets.

@vre
vre / Read kinesis stream oneliner
Last active June 9, 2017 11:22 — forked from LarsFronius/gist:e579051d7f140fd803b0
If you ever want to debug a Kinesis stream, copy this bash one liner.
# On a mac, `brew install awscli` before running and define your AWS account keys.
# Set the 'streamname' to match the name of your Kinesis stream
# For shell scripted version see https://gist.github.com/vre/997b336499824a0e56999d030dce321a
# Based on https://gist.github.com/LarsFronius/e579051d7f140fd803b0
# Works-For-Me aws-cli/1.11.36
streamname=my-kinesis-stream-name; aws kinesis describe-stream --stream-name $streamname --output text | grep SHARDS | awk '{print $2}' | while read shard; do aws kinesis get-shard-iterator --stream-name $streamname --shard-id $shard --shard-iterator-type LATEST --output text | while read iterator; do while output=`aws kinesis get-records --shard-iterator $iterator --output text`; do iterator=`echo "$output" | head -n1 | awk '{print $2}'`; echo "$output" | awk 'NR > 1' | grep RECORDS | while read record; do echo $record | awk '{print $3}' | base64 -D; done; done; done; done