Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save n3h3m/5262f774104e88e7e8cc5fc1e71a7448 to your computer and use it in GitHub Desktop.
Save n3h3m/5262f774104e88e7e8cc5fc1e71a7448 to your computer and use it in GitHub Desktop.
If you ever want to debug a kinesis stream, copy this bash one liner.
On a mac, `brew install awscli gnu-sed` before.
streamname=staging;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`; echo "$output" | gsed 1d | grep RECORDS | while read record; do echo $record | awk '{print $2}' | base64 -D; done; done; done; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment