Im working on an api gateway on aws services which performs BatchWriteItem operation to dynamodb. But I know there is a max 25 put items limit for one BatchWrite operation. Im new to vtl and Im not sure how to handle requests that have more than 25 put items. Im writing down my current body template.
Any hints or help will be appreciated. Thanks.
Body Mapping Template:
#set($inputRoot = $input.path('$'))
{
"RequestItems": {
"SensorDataTest": [
#foreach($elem in $inputRoot.sensorMessages)
{
"PutRequest":
{
"Item":
{
"GatewayID":
{
"N": "$inputRoot.gatewayMessage.gatewayID"
},
"SensorID": {
"N": "$elem.sensorID"
},
"SensorName": {
"S": "$elem.sensorName"
},
"ApplicationID": {
"N":"$elem.applicationID"
},
"NetworkID": {
"S":"$elem.networkID"
},
"DataMessageGUID": {
"S":"$elem.dataMessageGUID"
},
"MessageDate": {
"S":"$elem.messageDate"
},
"State": {
"N":"$elem.state"
},
"RawData": {
"S": "$elem.rawData"
},
"DataType": {
"S": "$elem.dataType"
},
"DataValue": {
"S": "$elem.dataValue"
},
"PlotValues": {
"S": "$elem.plotValues"
},
"PlotLabels": {
"S": "$elem.plotLabels"
},
"SignalStrength": {
"N":"$elem.signalStrength"
},
"BatteryLevel": {
"N": "$elem.batteryLevel"
},
"PendingChange": {
"S": "$elem.pendingChange"
}
}
}
}#if($foreach.hasNext),#end
#end
]
},
"ReturnConsumedCapacity": "TOTAL"
}