title: Writing data from Kinesis to S3
body: <p>I am writing data using the AWS SDK from a Java application that posts data to a Kinesis stream. This is done in batches of 10 records at once, using the following code;</p>
  
  <pre><code>// Convert to JSON object, and then to bytes...
                  ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
                  String json = ow.writeValueAsString(transaction);
  
                  // Add byte array to PutRecordsRequestEntry
                  PutRecordsRequestEntry record = new PutRecordsRequestEntry();
                  record.setPartitionKey(String.valueOf(java.util.UUID.randomUUID()));
                  record.setData(ByteBuffer.wrap(json.getBytes()));
  
                  // Add to list...
                  batch.add(record);
  
                  // Check and send batches
                  if(counter&gt;=batchLimit){
  
                      logger.info("Sending batch of " + batchLimit + " rows.");
  
                      putRecordsRequest.setRecords(batch);
                      PutRecordsResult result = amazonKinesisClient.putRecords(putRecordsRequest);
                      batch = new ArrayList&lt;&gt;();
                      counter=0;
  
                  }else{
                      counter++;
                  }
  </code></pre>
  
  <p>Then I have a nodejs lambda function that is triggered on every transaction received on Kinesis, and the idea is for it to write transactions coming in from Kinesis, and put them into a firehose stream of data for them to be saved to S3. </p>
  
  <pre><code>    var AWS = require('aws-sdk');
  var firehose = new AWS.Firehose();
  
  exports.handler = function(event, context) {
  
      console.log(event);
  
      var params = {
          DeliveryStreamName: "transaction-postings",
          Record: { 
              Data:  decodeURIComponent(event)
          }
      };
      firehose.putRecord(params, function(err, data) {
          if (err) console.log(err, err.stack); // an error occurred
          else    {  
              console.log(data);           // successful response
          }
  
          context.done();
      });
  };
  </code></pre>
  
  <p>However when looking at data on S3, all I see is the following, and not the JSON list of objects as I was expecting...</p>
  
  <pre><code>[object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object]
  </code></pre>
  
  <p>Can anybody please point to me what am I missing to stream data from Kinesis to s3, as JSON objects?</p>