@secondcontext/save-money
v0.2.0
Published
Architecture-aware AWS cost optimization using your local Claude CLI
Maintainers
Readme
save-money
Architecture-aware AWS cost optimization powered by your local Claude CLI.
Fetches real AWS cost data, scans your infrastructure files, queries live resource inventory, then invokes Claude to produce ranked, actionable cost-reduction recommendations — with an interactive deep-dive menu to go deeper on any item.
Usage
npx save-money [options]Or install globally:
npm install -g save-money
save-money [options]Options
| Flag | Description | Default |
|---|---|---|
| --profile <name> | AWS CLI profile to use (interactive picker if omitted) | $AWS_PROFILE or default |
| --region <name> | AWS region | $AWS_REGION or us-east-1 |
| --infra-dir <path> | Directory to scan for Terraform/CDK/CloudFormation files | . (current dir) |
| --no-infra | Skip infrastructure file scanning | — |
| --dry-run | Print the Claude prompt without invoking it | — |
| --claude-path <path> | Override path to the claude binary | auto-detected |
| -h, --help | Show help | — |
Examples
# Interactive profile picker
npx save-money
# Specify profile directly
npx save-money --profile my-aws-profile
# Point at your infrastructure directory
npx save-money --profile my-aws-profile --infra-dir ./infrastructure
# See the prompt that would be sent without calling Claude
npx save-money --profile my-aws-profile --dry-runPrerequisites
AWS CLI — configured with a profile that has these permissions:
ce:GetCostAndUsagece:GetCostForecastecs:ListClusters,ecs:ListServices,ecs:ListTasksrds:DescribeDBInstances,rds:DescribeDBClustersec2:DescribeInstances,ec2:DescribeNatGatewayselasticache:DescribeCacheClusterslambda:ListFunctionss3:ListBucketssts:GetCallerIdentity- (optional)
organizations:ListAccountsfor multi-account support - (optional)
sts:AssumeRolefor cross-account inventory
Claude CLI — install from https://claude.ai/download
What it does
- Fetches 4 weeks of AWS Cost Explorer data (with week-over-week trend analysis)
- Scans your working directory for infrastructure files (Terraform
.tf, CDK, CloudFormation) - Queries live AWS resource inventory across ECS, RDS, EC2, Lambda, ElastiCache, S3, and more
- For AWS Organizations management accounts: automatically enumerates linked accounts, fetches per-account costs, and assumes
OrganizationAccountAccessRolein each account to collect cross-account inventory - Renders an ASCII cost trend chart and top services bar chart
- Invokes Claude with all context to generate 5 ranked cost-reduction recommendations
- Opens an interactive menu to deep-dive into any recommendation or ask custom questions
Multi-account support
If your AWS profile is an Organizations management account, the tool automatically:
- Lists all linked accounts via
organizations:ListAccounts - Fetches per-account cost breakdowns
- Assumes
OrganizationAccountAccessRolein each linked account to collect resource inventory - Provides Claude with a full cross-account view
Environment variables
| Variable | Description |
|---|---|
| AWS_PROFILE | Default AWS profile (overridden by --profile) |
| AWS_REGION | Default region (overridden by --region) |
| NO_COLOR=1 | Disable ANSI color output |
