DynamoDB Lens - Analyze your DynamoDB environment
Project description
DynamoDB Lens
A set of tools to help understand DynamoDB table performance capabilities and potential cost optimization opportunities.
Installation and usage
Installation
python3 -m pip install dynamodb-lens
CLI usage
usage: dynamodb_lens.cli [-h] --table_name TABLE_NAME [--save_output] [--verbose]
optional arguments:
-h, --help show this help message and exit
--table_name TABLE_NAME
--save_output save the json formatted output to a file
--verbose Print the full output, otherwise a summary will be printed
Example:
python3 -m dynamodb_lens.cli --table_name sentences1
Table Analyzer
This library analyzes a table's current state, configuration and usage in order to estimate performance capabilities.
A DynamoDB Table's current partition count as well as table settings will determine its performance capabilities.
Partition count is not exposed directly, but we can infer the number of partitions in several ways:
- Count the number of Open DynamoDB Stream shards, it is a 1:1 mapping of Open shards to Partitions
- Check cloudwatch max Provisioned settings over the last 3 months
- Check cloudwatch max WCU/RCU utilization over the last 1 month
- Check current WCU/RCU settings on the table if Provisioned mode is currently configured
- Check the current storage utilization of the table
If Streams is not enabled, this program will estimate current number of partitions based on the maximum WCU/RCU values
calculated from the data gathered in #2-5 above.
DynamoDB tables never give back partitions once they've been allocated.
This is what is meant by "previous peak" in the documentation.
This program is more accurate if DynamoDB Streams is enabled for the table.
Enabling streams is outside the scope of this program, it can be done via:
aws dynamodb update-table --table-name <value> --stream-specification StreamEnabled=true,StreamViewType=KEYS_ONLY
and disabled with:
aws dynamodb update-table --table-name <value> --stream-specification StreamEnabled=false
Please review the documentation and understand the implications of running these commands before executing them.
TableAnalyzer class usage
The class can be imported and called directly if the dynamodb_lens.cli
doesn't fit the use case
The only required parameter is table_name, and optionally verbose=True|False
plus already instantiated boto3 clients can be passed in.
from dynamodb_lens.analyzer import TableAnalyzer
table = TableAnalyzer(
table_name='foo',
verbose=False
)
table.save_output()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for dynamodb_lens-23.10.dev5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9607f1b862970daf1cfe4153ed78443ed1b634da55a4c0f673f0ead0660e1e8 |
|
MD5 | 15d924dd540d770dbda79f5848ccc23e |
|
BLAKE2b-256 | 5c46040c22a8b38ee0bf03f4a48519861557b1e6688cbee96c85b48663f9945e |