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