-
-
Save vre/7ee11edb765bf9bbdf1ad4ab1790c7c1 to your computer and use it in GitHub Desktop.
If you ever want to debug a Kinesis stream, copy this bash one liner.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment