title: How to calculate Dynamodb item size? Getting validationerror 400KB Boto
body: <blockquote>
    <p>ValidationException: ValidationException: 400 Bad Request
    {u'message': u'Item size has exceeded the maximum allowed size', u'__type': u'com.amazon.coral.validate#ValidationException'}</p>
  </blockquote>
  
  <p>The item object I have, has size of 92004 Bytes</p>
  
  <pre><code>&gt;&gt;&gt; iii
  &lt;boto.dynamodb2.items.Item object at 0x7f7922c97190&gt;
  &gt;&gt;&gt; iiip = iii.prepare_full() # it is now in dynamodb format e.g. "Item":{"time":{"N":"300"}, "user":{"S":"self"}} 
  
  &gt;&gt;&gt; len(json.dumps(iiip))
  92004
  &gt;&gt;&gt;
  </code></pre>
  
  <p>The size I get <code>92004</code> is less than 400KB, Why do I see the above mentioned error when saving the item?</p>
  
  <p>Any pointers?</p>
  
  <h2>EDIT:</h2>
  
  <p>I played around with different sizes of data,</p>
  
  <pre><code>&gt;&gt;&gt; i00['Resources'] = "A" * 66848; len(json.dumps(i00))
  68481
  &gt;&gt;&gt; i = Item(ct.table, data=i00); i.save()
  True
  &gt;&gt;&gt; i.delete()
  True
  &gt;&gt;&gt; i00['Resources'] = "A" * 66849; len(json.dumps(i00))
  68482
  &gt;&gt;&gt; i = Item(ct.table, data=i00); i.save()
  Traceback (most recent call last):
    File "&lt;console&gt;", line 1, in &lt;module&gt;
    File "/var/www/virtualenv/ken/local/lib/python2.7/site-packages/boto/dynamodb2/items.py", line 455, in save
      returned = self.table._put_item(final_data, expects=expects)
    File "/var/www/virtualenv/ken/local/lib/python2.7/site-packages/boto/dynamodb2/table.py", line 835, in _put_item
      self.connection.put_item(self.table_name, item_data, **kwargs)
    File "/var/www/virtualenv/ken/local/lib/python2.7/site-packages/boto/dynamodb2/layer1.py", line 1510, in put_item
      body=json.dumps(params))
    File "/var/www/virtualenv/ken/local/lib/python2.7/site-packages/boto/dynamodb2/layer1.py", line 2842, in make_request
      retry_handler=self._retry_handler)
    File "/var/www/virtualenv/ken/local/lib/python2.7/site-packages/boto/connection.py", line 954, in _mexe
      status = retry_handler(response, i, next_sleep)
    File "/var/www/virtualenv/ken/local/lib/python2.7/site-packages/boto/dynamodb2/layer1.py", line 2882, in _retry_handler
      response.status, response.reason, data)
  ValidationException: ValidationException: 400 Bad Request
  {u'message': u'Item size has exceeded the maximum allowed size', u'__type': u'com.amazon.coral.validate#ValidationException'}
  </code></pre>
  
  <p>In other words, the size of cloudtrail data has to be less than <strong>68482</strong> bytes. I wonder why they claim it to be <strong>400KB</strong>. Clearly, I am missing something.</p>