Skip to content

feat(dynamodb-cost-optimizer): cost optimization skill for dynamodb#95

Open
LeeroyHannigan wants to merge 1 commit intoawslabs:mainfrom
LeeroyHannigan:main
Open

feat(dynamodb-cost-optimizer): cost optimization skill for dynamodb#95
LeeroyHannigan wants to merge 1 commit intoawslabs:mainfrom
LeeroyHannigan:main

Conversation

@LeeroyHannigan
Copy link

@LeeroyHannigan LeeroyHannigan commented Mar 18, 2026

feat: add dynamodb-cost-optimizer plugin

Closes #51

Description

Adds the dynamodb-cost-optimizer plugin — a self-contained skill that analyzes existing DynamoDB tables and identifies cost optimization opportunities across four dimensions:

  • Capacity mode — On-demand vs provisioned comparison with autoscaling simulation
  • Table class — Standard vs Standard-IA based on storage-to-throughput ratios
  • Utilization right-sizing — Detects over-provisioned throughput on tables and GSIs
  • Unused GSI detection — Finds GSIs with zero read activity and estimates savings

The plugin fetches live data from CloudWatch, the AWS Pricing API, and Cost Explorer to produce actionable savings recommendations in a formatted report.

What's included

Plugin (plugins/dynamodb-cost-optimizer/):

  • SKILL.md with trigger descriptions, prerequisite checks, and step-by-step workflow
  • 11 Python scripts: discovery, pricing, CloudWatch batching, autoscaling simulation, 4 analyzers, and a batch orchestrator
  • 53 unit tests covering all analyzers, config utilities, CloudWatch retry/batching, pricing parsing, and orchestration
  • requirements.txt (boto3 only)

Shared files:

  • marketplace.json — new dynamodb-cost-optimizer entry
  • CODEOWNERS — ownership entry for plugins/dynamodb-cost-optimizer
  • README.md — plugin table entry and detail section

Design decisions

  • No MCP servers — uses Bash(python3 scripts/*) to keep the plugin simple and portable
  • Parallel execution — all 4 analyzers run per table in a single analyze_all.py invocation (10 concurrent workers), minimizing agent tool calls
  • Autoscaling simulation — capacity mode analysis simulates optimal scale-out/scale-in behavior per AWS docs rather than using simple averages
  • Graceful degradation — Cost Explorer permission failures produce a warning rather than blocking the analysis
  • PITR and deletion protection — reports backup and protection status alongside cost recommendations

Prerequisites

  • Python 3.9+ with boto3
  • AWS credentials with: dynamodb:DescribeTable, dynamodb:ListTables, dynamodb:DescribeContinuousBackups, cloudwatch:GetMetricData, pricing:GetProducts, ce:GetCostAndUsage

Testing

bash
cd plugins/dynamodb-cost-optimizer/skills/optimize-dynamodb
python3 -m pytest tests/ -v

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.


import os
report_path = os.path.join(os.getcwd(), 'dynamodb-cost-report.md')
with open(report_path, 'w') as f:

Check warning

Code scanning / Semgrep OSS

Semgrep Finding: python.lang.best-practice.unspecified-open-encoding.unspecified-open-encoding Warning

Missing 'encoding' parameter. 'open()' uses device locale encodings by default, corrupting files with special characters. Specify the encoding to ensure cross-platform support when opening files in text mode (e.g. encoding="utf-8").
@scottschreckengaust scottschreckengaust added new plugin do-not-merge Do not merge the pull request labels Mar 18, 2026
Adds a new plugin that analyzes DynamoDB tables for cost optimization
across four dimensions: capacity mode, table class, utilization
right-sizing, and unused GSI detection.

Closes awslabs#51
@theagenticguy
Copy link
Contributor

This feels a little too granular to warrant it's own plugin. might be worth discussing in an RFC format

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge Do not merge the pull request new plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RFC: dynamodb-cost-optimizer

3 participants