title: Insert IoT message array as multiple rows in DynamoDB
body: <p>I'm starting a new project that involves some IoT devices sending every 5 minutes their status and other info to AWS IoT.</p>
  
  <p>The structure of the message is the following:
  <code>
  {
      "SNC":"C_SN_15263217541",
      "STATUS":"enable",
      "PLANT":{
          "PNAME":"nomeimpianto",
          "DVS":{
              "SD":[{
                      "SDSN":"LD_SN_15263987543",
                      "TT":"30/11/17 4:37 PM",
                      "STATUS":"Enable",
                      "TON":"3sec",
                      "TOFF":"6min",
                      "QTAC":"125",
                      "ALCODE":"201",
                      "ALDESC":"assenza scarico"
                  },
                  {
                      "SDSN":"LD_SN_15263987543",
                      "TT":"30/11/17 4:39 PM",
                      "STATUS":"Enable",
                      "TON":"3sec",
                      "TOFF":"6min",
                      "QTAC":"125",
                      "ALCODE":"201",
                      "ALDESC":"assenza scarico"
                  },<br>
                  {
                      "SDSN":"LD_SN_15263997545",
                      "TT":"30/11/17 4:37 PM",
                      "STATUS":"Enable",
                      "TON":"3sec",
                      "TOFF":"6min",
                      "QTAC":"125"<br>
                  },
                  {
                      "SDSN":"LD_SN_15263997545",
                      "TT":"30/11/17 4:39 PM",
                      "STATUS":"Enable",
                      "TON":"3sec",
                      "TOFF":"6min",
                      "QTAC":"125"
                  },<br>
                  {
                      "SDSN":"LD_SN_15123987543",
                      "TT":"30/11/17 4:37 PM",
                      "STATUS":"Enable",
                      "TON":"3sec",
                      "TOFF":"6min",
                      "QTAC":"125"<br>
                  },
                  {
                      "SDSN":"LD_SN_15123987543",
                      "TT":"30/11/17 4:39 PM",
                      "STATUS":"Enable",
                      "TON":"3sec",
                      "TOFF":"6min",
                      "QTAC":"125"<br>
                  }<br>
              ]
          }
      }
  }
  </code></p>
  
  <p>I created a rule that inserts the message on DynamoDB, and it's working nicely, but I'd need to create, for each message received, one row for each item in <code>PLANT.DVS.SD</code>.</p>
  
  <p>My DynamoDB table has as hashkey the field <code>PLANT.DVS.SD[x].SDSN</code> and as sort field <code>PLANT.DVS.SD[x].TT</code>.</p>
  
  <p>I tried with a DynamoDBv2 rule and I managed only to create one row per message with the whole array, but it's not what I'm looking for.</p>
  
  <p>So basically the problem is that I don't know how to structure the SQL statement in the rule definition.</p>
  
  <p>I know that <code>PLANT.DVS.SD</code>'s max length is 12, so the only idea that I've got is to create 12 IoT rules that insert on DynamoDB only the element at a specific position. Although if there is a better way to solve this problem dynamically, it'd be appreciated!</p>