determine size of a dynamodb object

0

how to determine the size of a dynamo DB attribute or to know the record that is the largest in the table. Are there any JS AWS SDK libraries that are helpful for these ?? https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/javascript_dynamodb_code_examples.html

asked a month ago522 views
1 Answer
2
Accepted Answer

You can't get item size statistics directly from the table, but you can of course calculate item sizes while reading or writing using this package: https://www.npmjs.com/package/ddb-calc

const CALC = require('ddb-calc')

const item = {
        "Id": {
            "N": "101"
        },
        "Title": {
            "S": "Book 101 Title"
        },
        "ISBN": {
            "S": "111-1111111111"
        },
        "Authors": {
            "L": [
                {
                    "S": "Author1"
                }
            ]
        },
        "Price": {
            "N": "2"
        },
        "Dimensions": {
            "S": "8.5 x 11.0 x 0.5"
        },
        "PageCount": {
            "N": "500"
        },
        "InPublication": {
            "BOOL": true
        },
        "ProductCategory": {
            "S": "Book"
        }
    }


const size =  CALC.CalculateSize(item);
{ 
    rcu: 1, 
    wcu: 1, 
    size: 137 
}
profile pictureAWS
EXPERT
answered a month ago
profile picture
EXPERT
reviewed 19 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions