npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

dil-costlens

v0.1.0

Published

Estimate & Optimize AWS CDK Costs before you deploy.

Downloads

6

Readme

CostLens-CDK

Estimate & Optimize AWS CDK Costs before you deploy.

Overview

CostLens-CDK is a developer-first tool to estimate monthly AWS costs for your CDK stacks before deployment. It synthesizes your CDK app, parses the resulting CloudFormation, estimates monthly costs for all major AWS resources, and provides LLM-powered insights. Supports CLI, CI, and PR comments.

Features

  • Supports all major AWS cost resources: EC2, EBS, RDS, Lambda, S3, DynamoDB, ElastiCache, API Gateway, ALB/NLB, NAT Gateway, CloudWatch, ECR, Data Transfer, and more.
  • Live AWS Pricing API integration with fallback to a local catalog for robust, up-to-date pricing.
  • Assumptions file for usage overrides and scenario modeling.
  • LLM-powered insights (local heuristics + Bedrock integration).
  • Beautiful CLI output and CI/PR integration.

Quick Start

1. Install dependencies

npm install

2. Build all packages

npx tsc --build

3. Synthesize your CDK app

cdk synth > cdk.out/template.json

4. Run CostLens-CDK (from built output)

node dist/cli/src/index.js analyze --region us-west-2 --format table

5. Output

  • Beautiful colorized table in the terminal
  • Optional JSON output for CI/automation
  • LLM-powered risk and optimization insights

CLI Usage

npx costlens analyze [options]

Options:

  • --region <region>: AWS region (default: us-east-1)
  • --assumptions <file>: Path to assumptions file (YAML/JSON)
  • --format <fmt>: Output format (table, json, or both)
  • --out <file>: Write JSON output to file
  • --no-free-tier: Ignore AWS free tier
  • --ci: CI mode (for GitHub Actions, etc)

Assumptions File

Override usage patterns for more accurate estimates. Example:

Lambda:
  MyFunction:
    monthlyInvocations: 10000000
    avgMsPerInvoke: 250
S3:
  MyBucket:
    storageGb: 500
    monthlyPutRequests: 100000

LLM Insights

  • Local heuristics flag risky or high-cost resources
  • Optionally integrates with Amazon Bedrock for advanced analysis
  • To enable Bedrock LLM-powered insights, set the environment variable BEDROCK_LLM=1 when running the CLI:
env BEDROCK_LLM=1 aws-vault exec dil-team-hackfest -- node dist/cli/src/index.js analyze --region us-west-2 --format table

If BEDROCK_LLM is not set, only local heuristics will be used for insights.

CI/CD Integration

  • GitHub Actions workflow included for PR cost comments
  • Example: .github/workflows/costlens-pr.yml

Extending the Catalog

  • See packages/pricing/src/catalog.json for fallback prices
  • Add more regions, instance types, or custom pricing as needed

Monorepo Structure

  • packages/core: IR types, parser, estimator
  • packages/pricing: Pricing engine (AWS API + catalog)
  • packages/reporter: CLI table and JSON output
  • packages/cli: CLI entrypoint
  • packages/llm: LLM/risk analysis

Contributing

Pull requests welcome! Please add tests and update documentation as needed.

License

Diligent