I have >100 files where each line is a json. It looks something like this (no commas & no []):
{"one":"one","two":{"tree":...}}
{"one":"one","two":{"tree":...}}
...
{"one":"one","two":{"tree":...}}
To be able to use aws firehose put-record-batch, file needs to be in the format:
[
{
"Data": blob
},
{
"Data": blob
},
...
]
I want to put all of these files to aws Firehose from terminal.
I'm looking to write a shell script that looks something like this:
for file in files
do
aws firehose put-record-batch --delivery-stream-name <name> --records file://$file
done
So there're 2 questions:
- How to transform the files into the applicable format
- And, how to iterate through all the files