Skip to content

Instantly share code, notes, and snippets.

@cjwebb
Last active July 15, 2016 14:32
Show Gist options
  • Save cjwebb/6f6c0ad987b76b1b5402d41f3ac920ec to your computer and use it in GitHub Desktop.
Save cjwebb/6f6c0ad987b76b1b5402d41f3ac920ec to your computer and use it in GitHub Desktop.
if [ -z "$1" ]
then
echo "Usage: ./kinesis-messages.sh <stream-name>"
exit 1
fi
streamname=$1; 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 | jq .; done; done; done; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment