aws-cost-calculator-cli 1.0.3__tar.gz → 1.8.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. aws_cost_calculator_cli-1.8.1/CHANGES.md +375 -0
  2. aws_cost_calculator_cli-1.8.1/MANIFEST.in +3 -0
  3. aws_cost_calculator_cli-1.8.1/PKG-INFO +437 -0
  4. aws_cost_calculator_cli-1.8.1/README.md +399 -0
  5. aws_cost_calculator_cli-1.8.1/aws_cost_calculator_cli.egg-info/PKG-INFO +437 -0
  6. {aws_cost_calculator_cli-1.0.3 → aws_cost_calculator_cli-1.8.1}/aws_cost_calculator_cli.egg-info/SOURCES.txt +9 -2
  7. {aws_cost_calculator_cli-1.0.3 → aws_cost_calculator_cli-1.8.1}/aws_cost_calculator_cli.egg-info/requires.txt +1 -0
  8. aws_cost_calculator_cli-1.8.1/cost_calculator/api_client.py +85 -0
  9. aws_cost_calculator_cli-1.8.1/cost_calculator/cli.py +1344 -0
  10. aws_cost_calculator_cli-1.8.1/cost_calculator/cur.py +244 -0
  11. aws_cost_calculator_cli-1.8.1/cost_calculator/drill.py +323 -0
  12. aws_cost_calculator_cli-1.8.1/cost_calculator/executor.py +291 -0
  13. aws_cost_calculator_cli-1.8.1/cost_calculator/forensics.py +321 -0
  14. aws_cost_calculator_cli-1.8.1/cost_calculator/monthly.py +242 -0
  15. aws_cost_calculator_cli-1.8.1/cost_calculator/trends.py +353 -0
  16. {aws_cost_calculator_cli-1.0.3 → aws_cost_calculator_cli-1.8.1}/setup.py +5 -4
  17. aws_cost_calculator_cli-1.0.3/COST_CALCULATION_METHODOLOGY.md +0 -130
  18. aws_cost_calculator_cli-1.0.3/MANIFEST.in +0 -3
  19. aws_cost_calculator_cli-1.0.3/PKG-INFO +0 -164
  20. aws_cost_calculator_cli-1.0.3/README.md +0 -127
  21. aws_cost_calculator_cli-1.0.3/aws_cost_calculator_cli.egg-info/PKG-INFO +0 -164
  22. aws_cost_calculator_cli-1.0.3/cost_calculator/cli.py +0 -543
  23. {aws_cost_calculator_cli-1.0.3 → aws_cost_calculator_cli-1.8.1}/LICENSE +0 -0
  24. {aws_cost_calculator_cli-1.0.3 → aws_cost_calculator_cli-1.8.1}/aws_cost_calculator_cli.egg-info/dependency_links.txt +0 -0
  25. {aws_cost_calculator_cli-1.0.3 → aws_cost_calculator_cli-1.8.1}/aws_cost_calculator_cli.egg-info/entry_points.txt +0 -0
  26. {aws_cost_calculator_cli-1.0.3 → aws_cost_calculator_cli-1.8.1}/aws_cost_calculator_cli.egg-info/top_level.txt +0 -0
  27. {aws_cost_calculator_cli-1.0.3 → aws_cost_calculator_cli-1.8.1}/cost_calculator/__init__.py +0 -0
  28. {aws_cost_calculator_cli-1.0.3 → aws_cost_calculator_cli-1.8.1}/setup.cfg +0 -0
@@ -0,0 +1,375 @@
1
+ # Changelog
2
+
3
+ ## Version 1.8.0 (2025-11-07)
4
+
5
+ ### Added
6
+ - **New `cc investigate` command** - Multi-stage cost investigation tool
7
+ - Combines cost analysis, resource inventory, and CloudTrail events
8
+ - Automatically finds SSO profiles for accounts
9
+ - Generates comprehensive markdown reports
10
+ - Supports `--no-cloudtrail` flag for faster execution
11
+ - Example: `cc investigate --profile myprofile --account 123456789012`
12
+
13
+ ### Changed
14
+ - **Package cleanup** - Excluded backend, tests, and notebooks from PyPI distribution
15
+ - Backend code is only for Lambda deployment, not needed in CLI package
16
+ - Reduces package size and eliminates unnecessary files
17
+
18
+ ### Security
19
+ - Verified no sensitive data (company names, account IDs) in PyPI package
20
+ - All example data uses generic placeholders
21
+
22
+ ## Version 1.7.0 (2025-11-06)
23
+
24
+ ### Added
25
+ - **`--resources` flag for `cc drill` command**: Resource-level cost analysis using CUR data
26
+ - Shows individual resource IDs (EC2 instances, RDS databases, S3 buckets, etc.)
27
+ - Queries AWS Cost and Usage Report via Athena
28
+ - Works with both local execution and Lambda backend
29
+ - Requires `--service` filter to be specified
30
+ - Example: `cc drill --service "EC2 - Other" --account 123456789012 --resources`
31
+ - Displays top 50 resources by cost with usage types and regions
32
+ - **`cc setup-cur` command**: Configure CUR settings for resource-level queries
33
+ - Saves configuration to `~/.config/cost-calculator/cur_config.json`
34
+ - Prompts for: Athena database, table name, S3 output location
35
+ - Required before using `--resources` flag
36
+
37
+ ### Security
38
+ - **CRITICAL**: Removed all hardcoded sensitive data from CUR queries
39
+ - No hardcoded account IDs
40
+ - No hardcoded database names
41
+ - No hardcoded S3 bucket paths
42
+ - All configuration must be provided by user via `cc setup-cur`
43
+
44
+ ### Technical Details
45
+ - New module: `cost_calculator/cur.py` for local CUR queries
46
+ - New module: `backend/algorithms/cur.py` for Lambda CUR queries
47
+ - Updated `backend/handlers/drill.py` to support resource-level queries
48
+ - Service-to-product-code mapping for flexible service name handling
49
+ - Athena query execution with automatic polling and result parsing
50
+ - CUR configuration loaded from `~/.config/cost-calculator/cur_config.json` or environment variables
51
+
52
+ ## Version 1.6.3 (2025-11-06)
53
+
54
+ ### Added
55
+ - **`cc setup-api` command**: Automatically configure COST_API_SECRET
56
+ - Saves to `~/.zshrc` or `~/.bashrc` on Mac/Linux
57
+ - Saves to Windows user environment variables
58
+ - Prompts for secret with hidden input
59
+ - Updates existing configuration if already present
60
+
61
+ ## Version 1.6.2 (2025-11-06)
62
+
63
+ ### Fixed
64
+ - Updated installation instructions to use PyPI instead of local editable install
65
+
66
+ ## Version 1.6.1 (2025-11-06)
67
+
68
+ ### Fixed
69
+ - Sanitized all documentation to remove company-specific references
70
+ - Removed real account IDs and credentials from examples
71
+ - Updated all examples to use generic placeholder names
72
+
73
+ ## Version 1.6.0 (2025-11-06) - YANKED
74
+
75
+ **Note:** This version was yanked due to unsanitized documentation containing company-specific information.
76
+
77
+ ### Added
78
+ - **Flexible Authentication**: Multiple authentication methods for all commands
79
+ - `--sso <profile>`: SSO authentication with automatic login if session expired
80
+ - `--access-key-id`, `--secret-access-key`, `--session-token`: Static credentials
81
+ - Environment variable support: `AWS_PROFILE` for SSO, `AWS_ACCESS_KEY_ID` for static
82
+ - Auto SSO login: CLI automatically runs `aws sso login` if session is expired
83
+ - Applied authentication flags to all commands: `calculate`, `trends`, `monthly`, `drill`
84
+
85
+ ### Changed
86
+ - Enhanced profile loading to check `AWS_PROFILE` environment variable for SSO support
87
+ - Updated README with comprehensive authentication documentation
88
+
89
+ ### Benefits
90
+ - No manual SSO login required - CLI handles it automatically
91
+ - Support for temporary credentials via CLI flags
92
+ - Flexible authentication for different use cases (CI/CD, local dev, etc.)
93
+
94
+ ## Version 1.5.0 (2024-11-04)
95
+
96
+ ### Added
97
+ - **Analyze Command**: Pandas-based aggregations and statistical analysis
98
+ - `cc analyze --type summary`: Aggregate costs across all weeks (sum, avg, std, min, max)
99
+ - `cc analyze --type volatility`: Identify high-volatility services and outliers
100
+ - `cc analyze --type trends`: Auto-detect increasing/decreasing cost trends
101
+ - `cc analyze --type search`: Filter services by pattern or minimum cost
102
+ - **Profile Management**: CRUD operations for account profiles
103
+ - `cc profile list`: List all profiles
104
+ - `cc profile get --name <profile>`: Get profile details
105
+ - `cc profile create/update/delete`: Manage profiles in DynamoDB
106
+ - **Lambda Enhancements**:
107
+ - New Analyze Lambda function with AWS Data Wrangler layer (pandas/numpy)
108
+ - New Profiles Lambda function for DynamoDB operations
109
+ - 2GB memory, 900s timeout for analyze function
110
+ - Time series analysis and statistical aggregations
111
+
112
+ ### Changed
113
+ - Suppressed progress messages in JSON output mode for cleaner parsing
114
+ - Updated API client to support new analyze and profiles endpoints
115
+
116
+ ### Fixed
117
+ - JSON output now properly formatted without extra echo statements
118
+
119
+ ## Version 1.4.0 (2025-11-04)
120
+
121
+ ### Features Added
122
+
123
+ #### Lambda API Backend Support
124
+ - **Hybrid execution**: CLI now supports both local and Lambda API execution
125
+ - Set `COST_API_URL` and `COST_API_SECRET` environment variables to use Lambda backend
126
+ - Falls back to local execution if API not configured
127
+ - **Identical results**: API and local execution produce exactly the same output
128
+ - No changes to CLI interface - completely transparent to users
129
+
130
+ #### Configuration
131
+ - Environment variables:
132
+ - `COST_API_URL`: Base URL for Lambda API
133
+ - `COST_API_SECRET`: Shared secret for API authentication
134
+ - Alternative: `~/.config/cost-calculator/api_config.json`
135
+
136
+ #### Benefits
137
+ - **Centralized logic**: Cost analysis runs on Lambda
138
+ - **Multiple interfaces**: Same backend for CLI, web UI, Jupyter
139
+ - **No code changes**: Existing CLI commands work identically
140
+ - **Flexible deployment**: Choose local or API execution
141
+
142
+ ### Example Usage
143
+ ```bash
144
+ # Use local execution (default)
145
+ cc trends --profile myprofile
146
+
147
+ # Use Lambda API
148
+ export COST_API_URL="https://xxx.lambda-url.us-east-1.on.aws"
149
+ export COST_API_SECRET="your-secret"
150
+ cc trends --profile myprofile # Same command, uses API
151
+ ```
152
+
153
+ ### Documentation
154
+ - Added API client module
155
+ - Added executor module for hybrid execution
156
+ - Updated README with API configuration instructions
157
+
158
+ ---
159
+
160
+ ## Version 1.3.0 (2025-11-04)
161
+
162
+ ### Features Added
163
+
164
+ #### Drill-Down Cost Analysis
165
+ - **New command:** `cc drill --profile <name>`
166
+ - Investigate cost changes at different levels of detail with automatic grouping
167
+ - **Funnel approach**: Start broad, drill deeper based on findings
168
+ - Supports three filter types:
169
+ - `--service`: Filter by service name (e.g., "EC2 - Other")
170
+ - `--account`: Filter by account ID
171
+ - `--usage-type`: Filter by usage type
172
+ - Filters can be combined for deeper analysis
173
+
174
+ #### Automatic Grouping Logic
175
+ The command automatically shows the next level of detail:
176
+ - **No filters** → Shows services (same as trends)
177
+ - **Service only** → Shows accounts using that service
178
+ - **Account only** → Shows services in that account
179
+ - **Service + Account** → Shows usage types within that service/account
180
+ - **All three filters** → Shows regions
181
+
182
+ #### What It Shows
183
+ - Week-over-week comparisons (default: 4 weeks)
184
+ - Top 10 increases and decreases at the appropriate detail level
185
+ - Total rows showing sum of top 10 changes
186
+ - Percentage change and dollar amount
187
+ - Filters out noise (>$10 and >5% change)
188
+ - Most recent comparisons first
189
+
190
+ #### Use Cases
191
+ - **Investigate spikes**: See EC2 costs up? Drill to find which account
192
+ - **Account analysis**: Which services are driving costs in a specific account?
193
+ - **Service deep-dive**: Which usage types within EC2 are increasing?
194
+ - **Root cause analysis**: Follow the funnel from service → account → usage type
195
+
196
+ ### Example Workflow
197
+ ```bash
198
+ # 1. Start broad - see EC2 costs up $1000
199
+ cc trends --profile myprofile
200
+
201
+ # 2. Drill by service - see which accounts
202
+ cc drill --profile myprofile --service "EC2 - Other"
203
+ # Output: Account 123 is +$800
204
+
205
+ # 3. Drill deeper - see usage types
206
+ cc drill --profile myprofile --service "EC2 - Other" --account 123
207
+ # Output: DataTransfer-Regional-Bytes is +$750
208
+ ```
209
+
210
+ ### Documentation
211
+ - Updated README.md with drill-down examples and funnel approach
212
+ - Added drill command to CLI help
213
+ - Documented automatic grouping logic
214
+
215
+ ---
216
+
217
+ ## Version 1.2.0 (2025-11-04)
218
+
219
+ ### Features Added
220
+
221
+ #### Month-over-Month Cost Analysis
222
+ - **New command:** `cc monthly --profile <name>`
223
+ - Analyzes month-over-month cost changes at service level
224
+ - Compares consecutive calendar months (October vs September, etc.)
225
+ - Generates comprehensive markdown report
226
+ - Supports custom number of months: `--months 12`
227
+ - JSON output option: `--json-output`
228
+ - Custom output file: `--output monthly_trends.md`
229
+
230
+ #### What It Shows
231
+ - Service-level aggregation (total cost per service)
232
+ - Top 10 increases and decreases per month comparison
233
+ - Total rows showing sum of top 10 changes
234
+ - Percentage change and dollar amount for each service
235
+ - Filters out noise (>$50 and >5% change)
236
+ - Most recent comparisons first (reverse chronological)
237
+
238
+ #### Use Cases
239
+ - Monthly cost review and budget tracking
240
+ - Identifying large month-over-month changes
241
+ - Understanding seasonal cost patterns
242
+ - Tracking major service additions or removals
243
+ - Long-term cost trend analysis
244
+
245
+ ### Example Output
246
+ ```
247
+ October 2025 → November 2025
248
+ Increases: 1, Decreases: 10
249
+ Top: Savings Plans for AWS Compute usage (+$231,161.46)
250
+ ```
251
+
252
+ ### Documentation
253
+ - Updated README.md with monthly command examples
254
+ - Added monthly report documentation
255
+
256
+ ---
257
+
258
+ ## Version 1.1.0 (2025-11-04)
259
+
260
+ ### Features Added
261
+
262
+ #### Cost Trends Analysis with Dual Methodology
263
+ - **New command:** `cc trends --profile <name>`
264
+ - Analyzes cost changes with **two comparison methods**:
265
+ 1. **Week-over-Week (WoW)**: Compares consecutive weeks - catches immediate spikes
266
+ 2. **Trailing 30-Day (T-30)**: Compares to 4 weeks ago - shows sustained trends
267
+ - **Service-level aggregation**: Shows total cost per service (not usage type detail)
268
+ - Generates comprehensive markdown report with both methodologies
269
+ - Supports custom number of weeks: `--weeks 18`
270
+ - JSON output option: `--json-output`
271
+ - Custom output file: `--output weekly_trends.md`
272
+
273
+ #### What It Shows
274
+ - **Week-over-Week section**: Consecutive week comparisons (Monday to Sunday)
275
+ - **T-30 section**: 30-day baseline comparisons
276
+ - Top 10 cost increases and decreases for each comparison
277
+ - **Total rows**: Sum of top 10 changes for quick assessment
278
+ - Percentage change and dollar amount for each service
279
+ - Automatically filters out noise (>$10 and >5% change)
280
+ - Most recent comparisons first (reverse chronological)
281
+
282
+ #### Why Two Methodologies?
283
+ - **WoW**: Catches immediate changes, spikes, and weekly volatility
284
+ - **T-30**: Filters out noise, reveals sustained trends and real cost changes
285
+ - Together they provide both **immediate alerts** and **trend analysis**
286
+
287
+ #### Use Cases
288
+ - Weekly cost monitoring and anomaly detection
289
+ - Identifying sudden cost spikes (WoW) vs sustained increases (T-30)
290
+ - Understanding which services are trending up or down
291
+ - Tracking cost optimization efforts over time
292
+ - Distinguishing temporary spikes from permanent cost changes
293
+
294
+ ### Example Output
295
+ ```
296
+ WEEK-OVER-WEEK:
297
+ Week of Oct 19 → Week of Oct 26
298
+ Increases: 4, Decreases: 10
299
+ Top: EC2 - Other (+$949.12)
300
+
301
+ TRAILING 30-DAY (T-30):
302
+ Week of Oct 26 vs Week of Sep 28
303
+ Increases: 10, Decreases: 10
304
+ Top: EC2 - Other (+$886.39)
305
+ ```
306
+
307
+ ### Documentation
308
+ - Updated README.md with dual methodology explanation
309
+ - Added trends report format documentation
310
+ - Updated CLI help text
311
+
312
+ ---
313
+
314
+ ## Version 1.0.0 (2025-11-04)
315
+
316
+ ### Features Added
317
+
318
+ #### 1. Static AWS Credentials Support
319
+ - **New command:** `cc configure --profile <name>`
320
+ - Allows using static AWS credentials instead of SSO
321
+ - Supports temporary credentials with session tokens
322
+ - Credentials stored securely in `~/.config/cost-calculator/credentials.json` (600 permissions)
323
+
324
+ #### 2. Dual Authentication Methods
325
+ - **SSO Method:** For interactive use (existing)
326
+ ```bash
327
+ aws sso login --profile my_sso_profile
328
+ cc calculate --profile myprofile
329
+ ```
330
+
331
+ - **Static Credentials Method:** For automation/CI (new)
332
+ ```bash
333
+ cc configure --profile myprofile
334
+ # Enter: Access Key ID, Secret Access Key, Session Token (optional)
335
+ cc calculate --profile myprofile
336
+ ```
337
+
338
+ #### 3. Enhanced Help Documentation
339
+ - Updated `cc --help` with authentication method examples
340
+ - Added comprehensive guides:
341
+ - `COST_CALCULATION_METHODOLOGY.md` - Formula explanation
342
+ - `WEEKLY_COST_HISTORY.md` - Historical cost trends
343
+ - `PYPI_UPLOAD_GUIDE.md` - Publishing instructions
344
+
345
+ #### 4. PyPI Packaging
346
+ - Prepared for PyPI distribution as `aws-cost-calculator-cli`
347
+ - Added proper metadata, classifiers, and dependencies
348
+ - Created upload script: `./upload_to_pypi.sh`
349
+ - Added LICENSE (MIT), MANIFEST.in, .gitignore
350
+
351
+ ### Security Enhancements
352
+ - Credentials file permissions set to 600 (owner read/write only)
353
+ - Sensitive files excluded from git (.gitignore)
354
+ - No credentials leaked in error messages or logs
355
+
356
+ ### Documentation
357
+ - **README.md:** Installation and usage guide
358
+ - **COST_CALCULATION_METHODOLOGY.md:** Detailed formula explanation
359
+ - **WEEKLY_COST_HISTORY.md:** 18 weeks of historical data
360
+ - **PYPI_UPLOAD_GUIDE.md:** Publishing instructions
361
+
362
+ ### Commands Available
363
+ 1. `cc init` - Initialize profile with account list
364
+ 2. `cc configure` - Configure AWS credentials (NEW)
365
+ 3. `cc calculate` - Calculate costs
366
+ 4. `cc list-profiles` - List configured profiles
367
+
368
+ ### Configuration Files
369
+ - `~/.config/cost-calculator/profiles.json` - Profile configurations
370
+ - `~/.config/cost-calculator/credentials.json` - AWS credentials (NEW)
371
+
372
+ ### Next Steps
373
+ 1. Test with temporary AWS credentials
374
+ 2. Upload to PyPI
375
+ 3. Install from PyPI: `pip install aws-cost-calculator-cli`
@@ -0,0 +1,3 @@
1
+ include README.md
2
+ include LICENSE
3
+ include CHANGES.md