Afeef_Acube
Afeef_Acube

Reputation: 1

How to solve the Error executing PutItem on dynamo db and how this error occurred?

Error executing PutItem on https://dynamodb.ap-south-1.amazonaws.com

AWS HTTP error: Client error: POST https://dynamodb.ap-south-1.amazonaws.com resulted in a 400 Bad Request

response:

{ 
    "__type":"com.amazon.coral.validate#ValidationException",
    "message":"Item size has exceeded the maximum allowed size"
}

Upvotes: 0

Views: 1288

Answers (1)

Lucasz
Lucasz

Reputation: 1218

You most likely have one or more local secondary indexes:

The amount of space used by an index item is the sum of the following:

    The size in bytes of the base table primary key (partition key and sort key)
    The size in bytes of the index key attribute
    The size in bytes of the projected attributes (if any)
    100 bytes of overhead per index item

And along with this note from The DynamoDB limits:

For each local secondary index on a table, there is a 400 KB limit on the total of the following:

    The size of an item's data in the table.
    The size of the local secondary index entry corresponding to that item, including its key values and projected attributes.

You need to pad the size of each item, since the PutItem requires enough space for the item, and the index data, and the total of both of those needs to be less than 400kb.

So, to summarize, the total data (item size) that ends up being saved in dynamodb table is :

Actual data * (number of indexes + 1).

Upvotes: 1

Related Questions