Skip to content

Instantly share code, notes, and snippets.

@miromasat
Created March 5, 2018 12:25
Show Gist options
  • Save miromasat/35bf73c8c47d9020d2ec01da98aa3e47 to your computer and use it in GitHub Desktop.
Save miromasat/35bf73c8c47d9020d2ec01da98aa3e47 to your computer and use it in GitHub Desktop.
publish random ruble into kinesis stream
#!/bin/sh
cat <<EOF >/home/ec2-user/kinesis_client.sh
#!/bin/sh
while true
do
eventTime=\$(date +"%Y-%m-%d-%T")
userId=\$(( ( RANDOM % 100000 ) + 1 ))
appId=\$(( ( RANDOM % 1000 ) + 1 ))
appScore=\$(( ( RANDOM % 100 ) + 1 ))
appData=SomeTestData
echo "\$eventTime,\$userId,\$appId,\$appScore,\$appData"
aws kinesis put-record --stream-name gleschen_stream --data "\$eventTime,\$userId,\$appId,\$appScore,\$appData"\$'\n' --partition-key \$appId --region us-east-1
done
EOF
chmod 775 /home/ec2-user/kinesis_client.sh
/home/ec2-user/kinesis_client.sh &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment