title: DynamoDB range keys exceeded size limit
body: <p>When I do a table.put_item I get the error message &quot;Aggregated size of all range keys has exceeded the size limit of 1024&quot;. What options do I have so I can save my data?</p>
  <ol>
  <li>Change a setting in DynamoDB to allow a larger limit?</li>
  <li>Split or compress the item and save to DynamoDB?</li>
  <li>Store the item in s3?</li>
  <li>Use another kind of database?</li>
  <li>Other options?</li>
  </ol>
  <p>Here is the specific code snippet:</p>
  <pre><code>def put_record(item):
  dynamodb = boto3.resource('dynamodb')
  table = dynamodb.Table('table_name')
  table.put_item(Item=item)
  </code></pre>
  <p>Here is an example of an item stored in DynamoDB. The two string variables p and r combined could be up to 4000 tokens.</p>
  <pre><code>{
    &quot;uuid&quot;: {
      &quot;S&quot;: &quot;5bf19498-344c&quot;
    },
    “p”: {
      &quot;S&quot;: “What is the next word after Mary had a”
    },
    “pp”: {
      &quot;S&quot;: &quot;0&quot;
    },
    &quot;response_length&quot;: {
      &quot;S&quot;: &quot;632&quot;
    },
    &quot;timestamp&quot;: {
      &quot;S&quot;: &quot;04/03/2022 06:30:55 AM CST&quot;
    },
    &quot;s&quot;: {
      &quot;S&quot;: &quot;1&quot;
    },
    &quot;c&quot;: {
      &quot;S&quot;: &quot;test&quot;
    },
    &quot;f&quot;: {
      &quot;S&quot;: &quot;0&quot;
    },
    &quot;t&quot;: {
      &quot;S&quot;: &quot;0.7&quot;
    },
    &quot;to&quot;: {
      &quot;S&quot;: &quot;1&quot;
    },
    &quot;b&quot;: {
      &quot;S&quot;: &quot;1&quot;
    },
    &quot;r&quot;: {
      &quot;S&quot;: “lamb”
    }
  }
  </code></pre>
  <p>I read this
  <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ServiceQuotas.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ServiceQuotas.html</a>
  and couldn't figure out how the 1024 is calculated but I'm assuming the two string variables are causing the error.</p>
  <p>The put_item doesn't cause an error when Item is a smaller size; only when the size is larger than the 1024 limit.</p>
  <p>It is hard to estimate how many of the saves will be large but I need to be able to save the large items. So from an architecture perspective willing to consider any and all options.</p>
  <p>Appreciate the assistance!</p>