简体   繁体   中英

aws kinesis put_record issue

I am using aws_cli command to send events to kinesis data stream but having some issues while putting record into kinesis stream

commands

USER_ID="3456"
input_data={"user_id": $USER_ID,"name":"siva","qulification":"degree","age":"27","location":"canada"}
aws kinesis put-record --stream-name b-in-stream  --partition-key 999 --data input_data

Note: USER_ID ==> its value is dynamic.

I used these commands on linux terminal but somehow aws-kinesis put-record is not working.

Can anyone suggest a solution how to use kinesis put-record with a variable in the data field?

If you are using bash in linux, your commands are incorrect. Your input data should be:

USER_ID="3456"

input_data='{"user_id": '$USER_ID',"name":"siva","qulification":"degree","age":"27","location":"canada"}'

Then, in the command you should use "${input_data}" , not input_data :

aws kinesis put-record --stream-name b-in-stream --partition-key 999 --data "${input_data}"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM