Hanshan
Hanshan

Reputation: 3764

boto3 Determine Storage Size of Table in DynamoDB

I know how to get the item count, but is there a way to determine the storage size of a table programatically?

In the console when you look at "Overview" of a table you can see the "Storage Size (in bytes)", it is that number I am after.

Upvotes: 0

Views: 1313

Answers (1)

Rajat Mishra
Rajat Mishra

Reputation: 3770

Assuming you are asking for DynamoDb. You can try following:

from boto3 import resource
from boto3.dynamodb.conditions import Key

# The boto3 dynamoDB resource
dynamodb_resource = resource('dynamodb')
table = dynamodb_resource.Table(table_name)
bytes_size = table.table_size_bytes

Upvotes: 4

Related Questions