aws-cost-calculator-cli 1.5.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.

Potentially problematic release.


This version of aws-cost-calculator-cli might be problematic. Click here for more details.

@@ -0,0 +1,130 @@
1
+ # AWS Cost Calculation Methodology
2
+
3
+ ## Formula Overview
4
+
5
+ The cost calculator computes a **daily rate** and **annual projection** for AWS spend across multiple accounts using a standardized methodology that matches the AWS Cost Explorer console.
6
+
7
+ ## What's Included
8
+
9
+ ### Operational Costs
10
+ - **All AWS services** billed under `BILLING_ENTITY = "AWS"`
11
+ - **Metric:** Net Amortized Cost
12
+ - **Accounts:** Multiple linked AWS accounts
13
+ - **Date Range:** 30-day rolling window, offset by 2 days from calculation date
14
+
15
+ ### Support Costs
16
+ - **AWS Support fees** from the 1st of the month containing the end date
17
+ - **Allocation:** 50% allocation (÷2)
18
+ - **Distribution:** Divided by days in the support month (e.g., 31 for October)
19
+
20
+ ## What's Excluded
21
+
22
+ 1. **Tax** - Excluded via `RECORD_TYPE != "Tax"`
23
+ 2. **Marketplace Services** - Excluded via `BILLING_ENTITY = "AWS"` filter
24
+ - Third-party SaaS subscriptions
25
+ - Marketplace software licenses
26
+ - Non-AWS vendor services
27
+ 3. **Support** - Excluded from operational costs, calculated separately
28
+
29
+ ## Calculation Steps
30
+
31
+ ### Step 1: Date Range Calculation
32
+ ```
33
+ Today = Calculation date (e.g., Nov 4, 2025)
34
+ Offset = 2 days (default)
35
+ Window = 30 days (default)
36
+
37
+ End Date = Today - Offset = Nov 2, 2025
38
+ Start Date = End Date - Window = Oct 3, 2025
39
+
40
+ Analysis Period: Oct 3 - Nov 2, 2025 (30 days)
41
+ ```
42
+
43
+ ### Step 2: Operational Cost Calculation
44
+ ```
45
+ Total Operational Cost = Sum of daily Net Amortized Costs
46
+ WHERE:
47
+ - Linked Account IN [configured accounts]
48
+ - Billing Entity = "AWS"
49
+ - Record Type NOT IN ["Tax", "Support"]
50
+ - Date BETWEEN Start Date AND End Date
51
+
52
+ Days in Support Month = Days in month containing End Date (e.g., 31 for October)
53
+
54
+ Daily Operational = Total Operational Cost ÷ Days in Support Month
55
+ ```
56
+
57
+ **Note:** We divide by the days in the support month (31 for October), NOT the window size (30 days). This matches the AWS console calculation.
58
+
59
+ ### Step 3: Support Cost Calculation
60
+ ```
61
+ Support Date = 1st of month containing End Date (e.g., Nov 1 for Oct 3-Nov 2 period)
62
+
63
+ Support Cost = Net Amortized Cost on Support Date
64
+ WHERE:
65
+ - Linked Account IN [configured accounts]
66
+ - Record Type = "Support"
67
+ - Date = Support Date
68
+
69
+ Support Per Day = (Support Cost ÷ 2) ÷ Days in Support Month
70
+ ```
71
+
72
+ **Rationale:** Support is charged on the 1st of each month for the previous month's usage. For an October analysis, we use the November 1st support charge (which reflects October usage based on September costs).
73
+
74
+ ### Step 4: Final Calculation
75
+ ```
76
+ Daily Rate = Daily Operational + Support Per Day
77
+
78
+ Annual Projection = Daily Rate × 365
79
+ ```
80
+
81
+ ## Example Calculation
82
+
83
+ **Analysis Period:** Oct 3 - Nov 2, 2025
84
+
85
+ ```
86
+ Total Operational Cost: $450,000.00
87
+ Days in October: 31
88
+ Daily Operational: $450,000.00 ÷ 31 = $14,516.13
89
+
90
+ Support (Nov 1): $15,000.00
91
+ Support Per Day: ($15,000.00 ÷ 2) ÷ 31 = $241.94
92
+
93
+ Daily Rate: $14,516.13 + $241.94 = $14,758.07
94
+ Annual Projection: $14,758.07 × 365 = $5,386,695
95
+ ```
96
+
97
+ ## Key Principles
98
+
99
+ 1. **Consistency:** Always use the same filters and methodology
100
+ 2. **Accuracy:** Match AWS Cost Explorer console calculations exactly
101
+ 3. **Transparency:** All costs are Net Amortized (includes RI/SP discounts)
102
+ 4. **Allocation:** Support can be split between entities (default 50/50)
103
+ 5. **Timeliness:** Use T-2 offset to ensure data completeness
104
+
105
+ ## Validation
106
+
107
+ To validate the calculation:
108
+ 1. Open AWS Cost Explorer console
109
+ 2. Set date range to the analysis period
110
+ 3. Filter by your linked accounts
111
+ 4. Set Billing Entity = AWS
112
+ 5. Exclude Tax and Support
113
+ 6. Compare total: Should match "Total Operational Cost"
114
+ 7. Daily average in console ÷ 31 days should match "Daily Operational"
115
+
116
+ ## CLI Usage
117
+
118
+ ```bash
119
+ # Default calculation (today - 2 days, 30-day window)
120
+ cc calculate --profile myprofile
121
+
122
+ # Specific start date
123
+ cc calculate --profile myprofile --start-date 2025-11-04
124
+
125
+ # Custom offset and window
126
+ cc calculate --profile myprofile --offset 2 --window 30
127
+
128
+ # JSON output
129
+ cc calculate --profile myprofile --json-output
130
+ ```
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Cost Optimization Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,3 @@
1
+ include README.md
2
+ include LICENSE
3
+ include COST_CALCULATION_METHODOLOGY.md
@@ -0,0 +1,291 @@
1
+ Metadata-Version: 2.4
2
+ Name: aws-cost-calculator-cli
3
+ Version: 1.5.1
4
+ Summary: AWS Cost Calculator CLI - Calculate daily and annual AWS costs across multiple accounts
5
+ Home-page: https://github.com/yourusername/cost-calculator
6
+ Author: Cost Optimization Team
7
+ Author-email:
8
+ Project-URL: Documentation, https://github.com/yourusername/cost-calculator/blob/main/README.md
9
+ Keywords: aws cost calculator billing optimization cloud
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: System Administrators
13
+ Classifier: Topic :: System :: Monitoring
14
+ Classifier: Topic :: Utilities
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Requires-Python: >=3.8
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: click>=8.0.0
25
+ Requires-Dist: boto3>=1.26.0
26
+ Requires-Dist: requests>=2.28.0
27
+ Dynamic: author
28
+ Dynamic: classifier
29
+ Dynamic: description
30
+ Dynamic: description-content-type
31
+ Dynamic: home-page
32
+ Dynamic: keywords
33
+ Dynamic: license-file
34
+ Dynamic: project-url
35
+ Dynamic: requires-dist
36
+ Dynamic: requires-python
37
+ Dynamic: summary
38
+
39
+ # AWS Cost Calculator (cc)
40
+
41
+ A CLI tool to quickly calculate AWS costs across multiple accounts.
42
+
43
+ ## Installation
44
+
45
+ ```bash
46
+ cd ~/cost-calculator
47
+ pip install -e .
48
+ ```
49
+
50
+ ## Quick Start
51
+
52
+ ### 1. Login to AWS SSO
53
+
54
+ ```bash
55
+ aws sso login --profile my_aws_profile
56
+ ```
57
+
58
+ **Note:** You need to do this before running cost calculations. The SSO session typically lasts 8-12 hours.
59
+
60
+ ### 2. Initialize a profile
61
+
62
+ ```bash
63
+ cc init --profile myprofile \
64
+ --aws-profile my_aws_profile \
65
+ --accounts "123456789012,234567890123,345678901234"
66
+ ```
67
+
68
+ ### 3. Calculate costs
69
+
70
+ ```bash
71
+ # Default: Today minus 2 days, going back 30 days
72
+ cc calculate --profile myprofile
73
+
74
+ # Specific start date
75
+ cc calculate --profile myprofile --start-date 2025-11-04
76
+
77
+ # Custom offset and window
78
+ cc calculate --profile myprofile --offset 2 --window 30
79
+
80
+ # JSON output
81
+ cc calculate --profile myprofile --json-output
82
+ ```
83
+
84
+ ### 4. Analyze cost trends
85
+
86
+ ```bash
87
+ # Analyze last 3 weeks (default)
88
+ cc trends --profile myprofile
89
+
90
+ # Analyze more weeks
91
+ cc trends --profile myprofile --weeks 5
92
+
93
+ # Custom output file
94
+ cc trends --profile myprofile --output weekly_trends.md
95
+
96
+ # JSON output
97
+ cc trends --profile myprofile --json-output
98
+ ```
99
+
100
+ ### 5. List profiles
101
+
102
+ ```bash
103
+ cc list-profiles
104
+ ```
105
+
106
+ ## How It Works
107
+
108
+ ### Date Calculation
109
+ - **Start Date**: Defaults to today, or specify with `--start-date`
110
+ - **Offset**: Days to go back from start date (default: 2)
111
+ - **Window**: Number of days to analyze (default: 30)
112
+
113
+ Example: If today is Nov 4, 2025:
114
+ - With offset=2, window=30: Analyzes Oct 3 - Nov 2 (30 days)
115
+
116
+ ### Cost Calculation
117
+ 1. **Operational Costs**: Sum of daily costs ÷ window days
118
+ 2. **Support Allocation**:
119
+ - Gets support cost from the analysis month
120
+ - Divides by 2 (50% allocation)
121
+ - Divides by days in that month
122
+ 3. **Daily Rate**: Operational + Support per day
123
+ 4. **Annual Projection**: Daily rate × 365
124
+
125
+ ### Filters Applied
126
+ - **Billing Entity**: AWS only (excludes marketplace)
127
+ - **Excluded**: Tax, Support (calculated separately)
128
+ - **Metric**: Net Amortized Cost
129
+
130
+ ## Configuration
131
+
132
+ Profiles are stored in: `~/.config/cost-calculator/profiles.json`
133
+
134
+ Example:
135
+ ```json
136
+ {
137
+ "myprofile": {
138
+ "aws_profile": "my_aws_profile",
139
+ "accounts": ["123456789012", "234567890123", "345678901234"]
140
+ }
141
+ }
142
+ ```
143
+
144
+ ## Examples
145
+
146
+ ```bash
147
+ # Quick daily check
148
+ cc calculate --profile myprofile
149
+
150
+ # Historical analysis
151
+ cc calculate --profile myprofile --start-date 2025-10-01
152
+
153
+ # Export to JSON for processing
154
+ cc calculate --profile myprofile --json-output > costs.json
155
+
156
+ # Different window size
157
+ cc calculate --profile myprofile --window 60
158
+
159
+ # Weekly cost trends analysis
160
+ cc trends --profile myprofile
161
+
162
+ # Analyze last 8 weeks
163
+ cc trends --profile myprofile --weeks 8
164
+
165
+ # Monthly cost trends analysis
166
+ cc monthly --profile myprofile
167
+
168
+ # Analyze last 12 months
169
+ cc monthly --profile myprofile --months 12
170
+
171
+ # Drill down into specific service
172
+ cc drill --profile myprofile --service "EC2 - Other"
173
+
174
+ # Drill down into specific account
175
+ cc drill --profile myprofile --account 123456789012
176
+
177
+ # Drill down into service within account
178
+ cc drill --profile myprofile --service "EC2 - Other" --account 123456789012
179
+ ```
180
+
181
+ ## Trends Report
182
+
183
+ The `trends` command generates a markdown report with **two types of analysis**:
184
+
185
+ ### 1. Week-over-Week (WoW)
186
+ Compares each week to the previous week - good for catching immediate spikes and changes.
187
+
188
+ ### 2. Trailing 30-Day (T-30)
189
+ Compares each week to the same week 4 weeks ago - filters out noise and shows sustained trends.
190
+
191
+ **Features:**
192
+ - **Service-level aggregation**: Shows total cost per service (not individual usage types)
193
+ - **Top 10 Increases/Decreases**: For each comparison period
194
+ - **Total rows**: Sum of top 10 changes for quick assessment
195
+ - **Filters**: Only shows changes >$10 and >5%
196
+
197
+ Example output:
198
+ ```
199
+ Week of Oct 19 → Week of Oct 26 (WoW)
200
+ Increases: 4, Decreases: 10
201
+ Top: EC2 - Other (+$949.12)
202
+
203
+ Week of Oct 26 vs Week of Sep 28 (T-30)
204
+ Increases: 10, Decreases: 10
205
+ Top: EC2 - Other (+$886.39)
206
+ ```
207
+
208
+ The report is saved to `cost_trends.md` by default and includes:
209
+ - Service name
210
+ - Previous/baseline cost
211
+ - Current cost
212
+ - Change amount and percentage
213
+ - Total of top 10 changes
214
+
215
+ ## Monthly Report
216
+
217
+ The `monthly` command generates month-over-month cost comparisons:
218
+
219
+ **Features:**
220
+ - **Service-level aggregation**: Shows total cost per service
221
+ - **Calendar month comparisons**: October vs September, September vs August, etc.
222
+ - **Top 10 Increases/Decreases**: For each month comparison
223
+ - **Total rows**: Sum of top 10 changes
224
+ - **Filters**: Only shows changes >$50 and >5%
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
+ The report is saved to `monthly_trends.md` by default.
234
+
235
+ ## Drill-Down Analysis
236
+
237
+ The `drill` command allows you to investigate cost changes at different levels of detail:
238
+
239
+ **Funnel Approach:**
240
+ 1. **Start broad:** `cc trends` → See EC2 costs up $1000
241
+ 2. **Drill by service:** `cc drill --service "EC2 - Other"` → See which accounts
242
+ 3. **Drill deeper:** `cc drill --service "EC2 - Other" --account 123` → See usage types
243
+
244
+ **Features:**
245
+ - **Week-over-week cost analysis**: Compare costs between consecutive weeks
246
+ - **Month-over-month cost analysis**: Compare costs between consecutive months
247
+ - **Drill-down analysis**: Analyze costs by service, account, or usage type
248
+ - **Pandas aggregations**: Time series analysis with sum, avg, std across all weeks
249
+ - **Volatility detection**: Identify services with high cost variability and outliers
250
+ - **Trend detection**: Auto-detect increasing/decreasing cost patterns
251
+ - **Search & filter**: Find services by pattern or cost threshold
252
+ - **Profile management**: CRUD operations for account profiles in DynamoDB
253
+ - **Markdown reports**: Generate formatted reports
254
+ - **JSON output**: Machine-readable output for automation
255
+ - **Lambda API backend**: Serverless backend with pandas/numpy support
256
+
257
+ Example output:
258
+ ```
259
+ # Drill by service
260
+ cc drill --profile myprofile --service "EC2 - Other"
261
+
262
+ Showing top accounts:
263
+ Week of Oct 19 → Week of Oct 26
264
+ Increases: 3, Decreases: 2
265
+ Top: 887649220066 (+$450.23)
266
+ ```
267
+
268
+ The report is saved to `drill_down.md` by default.
269
+
270
+ ## Output
271
+
272
+ ```
273
+ Analyzing: 2025-10-03 to 2025-11-02 (30 days)
274
+ AWS Profile: my_aws_profile
275
+ Accounts: 3
276
+
277
+ Fetching cost data...
278
+ Fetching support costs...
279
+ ============================================================
280
+ Period: 2025-10-03 to 2025-11-02
281
+ Days analyzed: 30
282
+ ============================================================
283
+ Total operational cost: $450,000.00
284
+ Daily operational: $14,516.13
285
+ Support (month): $15,000.00
286
+ Support per day (÷2÷days): $241.94
287
+ ============================================================
288
+ DAILY RATE: $14,758.07
289
+ ANNUAL PROJECTION: $5,386,695
290
+ ============================================================
291
+ ```
@@ -0,0 +1,253 @@
1
+ # AWS Cost Calculator (cc)
2
+
3
+ A CLI tool to quickly calculate AWS costs across multiple accounts.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ cd ~/cost-calculator
9
+ pip install -e .
10
+ ```
11
+
12
+ ## Quick Start
13
+
14
+ ### 1. Login to AWS SSO
15
+
16
+ ```bash
17
+ aws sso login --profile my_aws_profile
18
+ ```
19
+
20
+ **Note:** You need to do this before running cost calculations. The SSO session typically lasts 8-12 hours.
21
+
22
+ ### 2. Initialize a profile
23
+
24
+ ```bash
25
+ cc init --profile myprofile \
26
+ --aws-profile my_aws_profile \
27
+ --accounts "123456789012,234567890123,345678901234"
28
+ ```
29
+
30
+ ### 3. Calculate costs
31
+
32
+ ```bash
33
+ # Default: Today minus 2 days, going back 30 days
34
+ cc calculate --profile myprofile
35
+
36
+ # Specific start date
37
+ cc calculate --profile myprofile --start-date 2025-11-04
38
+
39
+ # Custom offset and window
40
+ cc calculate --profile myprofile --offset 2 --window 30
41
+
42
+ # JSON output
43
+ cc calculate --profile myprofile --json-output
44
+ ```
45
+
46
+ ### 4. Analyze cost trends
47
+
48
+ ```bash
49
+ # Analyze last 3 weeks (default)
50
+ cc trends --profile myprofile
51
+
52
+ # Analyze more weeks
53
+ cc trends --profile myprofile --weeks 5
54
+
55
+ # Custom output file
56
+ cc trends --profile myprofile --output weekly_trends.md
57
+
58
+ # JSON output
59
+ cc trends --profile myprofile --json-output
60
+ ```
61
+
62
+ ### 5. List profiles
63
+
64
+ ```bash
65
+ cc list-profiles
66
+ ```
67
+
68
+ ## How It Works
69
+
70
+ ### Date Calculation
71
+ - **Start Date**: Defaults to today, or specify with `--start-date`
72
+ - **Offset**: Days to go back from start date (default: 2)
73
+ - **Window**: Number of days to analyze (default: 30)
74
+
75
+ Example: If today is Nov 4, 2025:
76
+ - With offset=2, window=30: Analyzes Oct 3 - Nov 2 (30 days)
77
+
78
+ ### Cost Calculation
79
+ 1. **Operational Costs**: Sum of daily costs ÷ window days
80
+ 2. **Support Allocation**:
81
+ - Gets support cost from the analysis month
82
+ - Divides by 2 (50% allocation)
83
+ - Divides by days in that month
84
+ 3. **Daily Rate**: Operational + Support per day
85
+ 4. **Annual Projection**: Daily rate × 365
86
+
87
+ ### Filters Applied
88
+ - **Billing Entity**: AWS only (excludes marketplace)
89
+ - **Excluded**: Tax, Support (calculated separately)
90
+ - **Metric**: Net Amortized Cost
91
+
92
+ ## Configuration
93
+
94
+ Profiles are stored in: `~/.config/cost-calculator/profiles.json`
95
+
96
+ Example:
97
+ ```json
98
+ {
99
+ "myprofile": {
100
+ "aws_profile": "my_aws_profile",
101
+ "accounts": ["123456789012", "234567890123", "345678901234"]
102
+ }
103
+ }
104
+ ```
105
+
106
+ ## Examples
107
+
108
+ ```bash
109
+ # Quick daily check
110
+ cc calculate --profile myprofile
111
+
112
+ # Historical analysis
113
+ cc calculate --profile myprofile --start-date 2025-10-01
114
+
115
+ # Export to JSON for processing
116
+ cc calculate --profile myprofile --json-output > costs.json
117
+
118
+ # Different window size
119
+ cc calculate --profile myprofile --window 60
120
+
121
+ # Weekly cost trends analysis
122
+ cc trends --profile myprofile
123
+
124
+ # Analyze last 8 weeks
125
+ cc trends --profile myprofile --weeks 8
126
+
127
+ # Monthly cost trends analysis
128
+ cc monthly --profile myprofile
129
+
130
+ # Analyze last 12 months
131
+ cc monthly --profile myprofile --months 12
132
+
133
+ # Drill down into specific service
134
+ cc drill --profile myprofile --service "EC2 - Other"
135
+
136
+ # Drill down into specific account
137
+ cc drill --profile myprofile --account 123456789012
138
+
139
+ # Drill down into service within account
140
+ cc drill --profile myprofile --service "EC2 - Other" --account 123456789012
141
+ ```
142
+
143
+ ## Trends Report
144
+
145
+ The `trends` command generates a markdown report with **two types of analysis**:
146
+
147
+ ### 1. Week-over-Week (WoW)
148
+ Compares each week to the previous week - good for catching immediate spikes and changes.
149
+
150
+ ### 2. Trailing 30-Day (T-30)
151
+ Compares each week to the same week 4 weeks ago - filters out noise and shows sustained trends.
152
+
153
+ **Features:**
154
+ - **Service-level aggregation**: Shows total cost per service (not individual usage types)
155
+ - **Top 10 Increases/Decreases**: For each comparison period
156
+ - **Total rows**: Sum of top 10 changes for quick assessment
157
+ - **Filters**: Only shows changes >$10 and >5%
158
+
159
+ Example output:
160
+ ```
161
+ Week of Oct 19 → Week of Oct 26 (WoW)
162
+ Increases: 4, Decreases: 10
163
+ Top: EC2 - Other (+$949.12)
164
+
165
+ Week of Oct 26 vs Week of Sep 28 (T-30)
166
+ Increases: 10, Decreases: 10
167
+ Top: EC2 - Other (+$886.39)
168
+ ```
169
+
170
+ The report is saved to `cost_trends.md` by default and includes:
171
+ - Service name
172
+ - Previous/baseline cost
173
+ - Current cost
174
+ - Change amount and percentage
175
+ - Total of top 10 changes
176
+
177
+ ## Monthly Report
178
+
179
+ The `monthly` command generates month-over-month cost comparisons:
180
+
181
+ **Features:**
182
+ - **Service-level aggregation**: Shows total cost per service
183
+ - **Calendar month comparisons**: October vs September, September vs August, etc.
184
+ - **Top 10 Increases/Decreases**: For each month comparison
185
+ - **Total rows**: Sum of top 10 changes
186
+ - **Filters**: Only shows changes >$50 and >5%
187
+
188
+ Example output:
189
+ ```
190
+ October 2025 → November 2025
191
+ Increases: 1, Decreases: 10
192
+ Top: Savings Plans for AWS Compute usage (+$231,161.46)
193
+ ```
194
+
195
+ The report is saved to `monthly_trends.md` by default.
196
+
197
+ ## Drill-Down Analysis
198
+
199
+ The `drill` command allows you to investigate cost changes at different levels of detail:
200
+
201
+ **Funnel Approach:**
202
+ 1. **Start broad:** `cc trends` → See EC2 costs up $1000
203
+ 2. **Drill by service:** `cc drill --service "EC2 - Other"` → See which accounts
204
+ 3. **Drill deeper:** `cc drill --service "EC2 - Other" --account 123` → See usage types
205
+
206
+ **Features:**
207
+ - **Week-over-week cost analysis**: Compare costs between consecutive weeks
208
+ - **Month-over-month cost analysis**: Compare costs between consecutive months
209
+ - **Drill-down analysis**: Analyze costs by service, account, or usage type
210
+ - **Pandas aggregations**: Time series analysis with sum, avg, std across all weeks
211
+ - **Volatility detection**: Identify services with high cost variability and outliers
212
+ - **Trend detection**: Auto-detect increasing/decreasing cost patterns
213
+ - **Search & filter**: Find services by pattern or cost threshold
214
+ - **Profile management**: CRUD operations for account profiles in DynamoDB
215
+ - **Markdown reports**: Generate formatted reports
216
+ - **JSON output**: Machine-readable output for automation
217
+ - **Lambda API backend**: Serverless backend with pandas/numpy support
218
+
219
+ Example output:
220
+ ```
221
+ # Drill by service
222
+ cc drill --profile myprofile --service "EC2 - Other"
223
+
224
+ Showing top accounts:
225
+ Week of Oct 19 → Week of Oct 26
226
+ Increases: 3, Decreases: 2
227
+ Top: 887649220066 (+$450.23)
228
+ ```
229
+
230
+ The report is saved to `drill_down.md` by default.
231
+
232
+ ## Output
233
+
234
+ ```
235
+ Analyzing: 2025-10-03 to 2025-11-02 (30 days)
236
+ AWS Profile: my_aws_profile
237
+ Accounts: 3
238
+
239
+ Fetching cost data...
240
+ Fetching support costs...
241
+ ============================================================
242
+ Period: 2025-10-03 to 2025-11-02
243
+ Days analyzed: 30
244
+ ============================================================
245
+ Total operational cost: $450,000.00
246
+ Daily operational: $14,516.13
247
+ Support (month): $15,000.00
248
+ Support per day (÷2÷days): $241.94
249
+ ============================================================
250
+ DAILY RATE: $14,758.07
251
+ ANNUAL PROJECTION: $5,386,695
252
+ ============================================================
253
+ ```