aws-cost-calculator-cli 1.3.0__py3-none-any.whl
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.
- aws_cost_calculator_cli-1.3.0.dist-info/METADATA +287 -0
- aws_cost_calculator_cli-1.3.0.dist-info/RECORD +11 -0
- aws_cost_calculator_cli-1.3.0.dist-info/WHEEL +5 -0
- aws_cost_calculator_cli-1.3.0.dist-info/entry_points.txt +2 -0
- aws_cost_calculator_cli-1.3.0.dist-info/licenses/LICENSE +21 -0
- aws_cost_calculator_cli-1.3.0.dist-info/top_level.txt +1 -0
- cost_calculator/__init__.py +2 -0
- cost_calculator/cli.py +848 -0
- cost_calculator/drill.py +323 -0
- cost_calculator/monthly.py +242 -0
- cost_calculator/trends.py +353 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aws-cost-calculator-cli
|
|
3
|
+
Version: 1.3.0
|
|
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
|
+
Dynamic: author
|
|
27
|
+
Dynamic: classifier
|
|
28
|
+
Dynamic: description
|
|
29
|
+
Dynamic: description-content-type
|
|
30
|
+
Dynamic: home-page
|
|
31
|
+
Dynamic: keywords
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
Dynamic: project-url
|
|
34
|
+
Dynamic: requires-dist
|
|
35
|
+
Dynamic: requires-python
|
|
36
|
+
Dynamic: summary
|
|
37
|
+
|
|
38
|
+
# AWS Cost Calculator (cc)
|
|
39
|
+
|
|
40
|
+
A CLI tool to quickly calculate AWS costs across multiple accounts.
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
cd ~/cost-calculator
|
|
46
|
+
pip install -e .
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Quick Start
|
|
50
|
+
|
|
51
|
+
### 1. Login to AWS SSO
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
aws sso login --profile my_aws_profile
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Note:** You need to do this before running cost calculations. The SSO session typically lasts 8-12 hours.
|
|
58
|
+
|
|
59
|
+
### 2. Initialize a profile
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
cc init --profile myprofile \
|
|
63
|
+
--aws-profile my_aws_profile \
|
|
64
|
+
--accounts "123456789012,234567890123,345678901234"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 3. Calculate costs
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Default: Today minus 2 days, going back 30 days
|
|
71
|
+
cc calculate --profile myprofile
|
|
72
|
+
|
|
73
|
+
# Specific start date
|
|
74
|
+
cc calculate --profile myprofile --start-date 2025-11-04
|
|
75
|
+
|
|
76
|
+
# Custom offset and window
|
|
77
|
+
cc calculate --profile myprofile --offset 2 --window 30
|
|
78
|
+
|
|
79
|
+
# JSON output
|
|
80
|
+
cc calculate --profile myprofile --json-output
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 4. Analyze cost trends
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Analyze last 3 weeks (default)
|
|
87
|
+
cc trends --profile myprofile
|
|
88
|
+
|
|
89
|
+
# Analyze more weeks
|
|
90
|
+
cc trends --profile myprofile --weeks 5
|
|
91
|
+
|
|
92
|
+
# Custom output file
|
|
93
|
+
cc trends --profile myprofile --output weekly_trends.md
|
|
94
|
+
|
|
95
|
+
# JSON output
|
|
96
|
+
cc trends --profile myprofile --json-output
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 5. List profiles
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
cc list-profiles
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## How It Works
|
|
106
|
+
|
|
107
|
+
### Date Calculation
|
|
108
|
+
- **Start Date**: Defaults to today, or specify with `--start-date`
|
|
109
|
+
- **Offset**: Days to go back from start date (default: 2)
|
|
110
|
+
- **Window**: Number of days to analyze (default: 30)
|
|
111
|
+
|
|
112
|
+
Example: If today is Nov 4, 2025:
|
|
113
|
+
- With offset=2, window=30: Analyzes Oct 3 - Nov 2 (30 days)
|
|
114
|
+
|
|
115
|
+
### Cost Calculation
|
|
116
|
+
1. **Operational Costs**: Sum of daily costs ÷ window days
|
|
117
|
+
2. **Support Allocation**:
|
|
118
|
+
- Gets support cost from the analysis month
|
|
119
|
+
- Divides by 2 (50% allocation)
|
|
120
|
+
- Divides by days in that month
|
|
121
|
+
3. **Daily Rate**: Operational + Support per day
|
|
122
|
+
4. **Annual Projection**: Daily rate × 365
|
|
123
|
+
|
|
124
|
+
### Filters Applied
|
|
125
|
+
- **Billing Entity**: AWS only (excludes marketplace)
|
|
126
|
+
- **Excluded**: Tax, Support (calculated separately)
|
|
127
|
+
- **Metric**: Net Amortized Cost
|
|
128
|
+
|
|
129
|
+
## Configuration
|
|
130
|
+
|
|
131
|
+
Profiles are stored in: `~/.config/cost-calculator/profiles.json`
|
|
132
|
+
|
|
133
|
+
Example:
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"myprofile": {
|
|
137
|
+
"aws_profile": "my_aws_profile",
|
|
138
|
+
"accounts": ["123456789012", "234567890123", "345678901234"]
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Examples
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# Quick daily check
|
|
147
|
+
cc calculate --profile myprofile
|
|
148
|
+
|
|
149
|
+
# Historical analysis
|
|
150
|
+
cc calculate --profile myprofile --start-date 2025-10-01
|
|
151
|
+
|
|
152
|
+
# Export to JSON for processing
|
|
153
|
+
cc calculate --profile myprofile --json-output > costs.json
|
|
154
|
+
|
|
155
|
+
# Different window size
|
|
156
|
+
cc calculate --profile myprofile --window 60
|
|
157
|
+
|
|
158
|
+
# Weekly cost trends analysis
|
|
159
|
+
cc trends --profile myprofile
|
|
160
|
+
|
|
161
|
+
# Analyze last 8 weeks
|
|
162
|
+
cc trends --profile myprofile --weeks 8
|
|
163
|
+
|
|
164
|
+
# Monthly cost trends analysis
|
|
165
|
+
cc monthly --profile myprofile
|
|
166
|
+
|
|
167
|
+
# Analyze last 12 months
|
|
168
|
+
cc monthly --profile myprofile --months 12
|
|
169
|
+
|
|
170
|
+
# Drill down into specific service
|
|
171
|
+
cc drill --profile myprofile --service "EC2 - Other"
|
|
172
|
+
|
|
173
|
+
# Drill down into specific account
|
|
174
|
+
cc drill --profile myprofile --account 123456789012
|
|
175
|
+
|
|
176
|
+
# Drill down into service within account
|
|
177
|
+
cc drill --profile myprofile --service "EC2 - Other" --account 123456789012
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Trends Report
|
|
181
|
+
|
|
182
|
+
The `trends` command generates a markdown report with **two types of analysis**:
|
|
183
|
+
|
|
184
|
+
### 1. Week-over-Week (WoW)
|
|
185
|
+
Compares each week to the previous week - good for catching immediate spikes and changes.
|
|
186
|
+
|
|
187
|
+
### 2. Trailing 30-Day (T-30)
|
|
188
|
+
Compares each week to the same week 4 weeks ago - filters out noise and shows sustained trends.
|
|
189
|
+
|
|
190
|
+
**Features:**
|
|
191
|
+
- **Service-level aggregation**: Shows total cost per service (not individual usage types)
|
|
192
|
+
- **Top 10 Increases/Decreases**: For each comparison period
|
|
193
|
+
- **Total rows**: Sum of top 10 changes for quick assessment
|
|
194
|
+
- **Filters**: Only shows changes >$10 and >5%
|
|
195
|
+
|
|
196
|
+
Example output:
|
|
197
|
+
```
|
|
198
|
+
Week of Oct 19 → Week of Oct 26 (WoW)
|
|
199
|
+
Increases: 4, Decreases: 10
|
|
200
|
+
Top: EC2 - Other (+$949.12)
|
|
201
|
+
|
|
202
|
+
Week of Oct 26 vs Week of Sep 28 (T-30)
|
|
203
|
+
Increases: 10, Decreases: 10
|
|
204
|
+
Top: EC2 - Other (+$886.39)
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
The report is saved to `cost_trends.md` by default and includes:
|
|
208
|
+
- Service name
|
|
209
|
+
- Previous/baseline cost
|
|
210
|
+
- Current cost
|
|
211
|
+
- Change amount and percentage
|
|
212
|
+
- Total of top 10 changes
|
|
213
|
+
|
|
214
|
+
## Monthly Report
|
|
215
|
+
|
|
216
|
+
The `monthly` command generates month-over-month cost comparisons:
|
|
217
|
+
|
|
218
|
+
**Features:**
|
|
219
|
+
- **Service-level aggregation**: Shows total cost per service
|
|
220
|
+
- **Calendar month comparisons**: October vs September, September vs August, etc.
|
|
221
|
+
- **Top 10 Increases/Decreases**: For each month comparison
|
|
222
|
+
- **Total rows**: Sum of top 10 changes
|
|
223
|
+
- **Filters**: Only shows changes >$50 and >5%
|
|
224
|
+
|
|
225
|
+
Example output:
|
|
226
|
+
```
|
|
227
|
+
October 2025 → November 2025
|
|
228
|
+
Increases: 1, Decreases: 10
|
|
229
|
+
Top: Savings Plans for AWS Compute usage (+$231,161.46)
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
The report is saved to `monthly_trends.md` by default.
|
|
233
|
+
|
|
234
|
+
## Drill-Down Analysis
|
|
235
|
+
|
|
236
|
+
The `drill` command allows you to investigate cost changes at different levels of detail:
|
|
237
|
+
|
|
238
|
+
**Funnel Approach:**
|
|
239
|
+
1. **Start broad:** `cc trends` → See EC2 costs up $1000
|
|
240
|
+
2. **Drill by service:** `cc drill --service "EC2 - Other"` → See which accounts
|
|
241
|
+
3. **Drill deeper:** `cc drill --service "EC2 - Other" --account 123` → See usage types
|
|
242
|
+
|
|
243
|
+
**Features:**
|
|
244
|
+
- **Automatic grouping**: Shows the next level of detail based on your filters
|
|
245
|
+
- No filters → Shows services
|
|
246
|
+
- Service only → Shows accounts using that service
|
|
247
|
+
- Account only → Shows services in that account
|
|
248
|
+
- Service + Account → Shows usage types
|
|
249
|
+
- **Top 10 Increases/Decreases**: For each week comparison
|
|
250
|
+
- **Total rows**: Sum of top 10 changes
|
|
251
|
+
- **Filters**: Only shows changes >$10 and >5%
|
|
252
|
+
|
|
253
|
+
Example output:
|
|
254
|
+
```
|
|
255
|
+
# Drill by service
|
|
256
|
+
cc drill --profile myprofile --service "EC2 - Other"
|
|
257
|
+
|
|
258
|
+
Showing top accounts:
|
|
259
|
+
Week of Oct 19 → Week of Oct 26
|
|
260
|
+
Increases: 3, Decreases: 2
|
|
261
|
+
Top: 887649220066 (+$450.23)
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
The report is saved to `drill_down.md` by default.
|
|
265
|
+
|
|
266
|
+
## Output
|
|
267
|
+
|
|
268
|
+
```
|
|
269
|
+
Analyzing: 2025-10-03 to 2025-11-02 (30 days)
|
|
270
|
+
AWS Profile: my_aws_profile
|
|
271
|
+
Accounts: 3
|
|
272
|
+
|
|
273
|
+
Fetching cost data...
|
|
274
|
+
Fetching support costs...
|
|
275
|
+
============================================================
|
|
276
|
+
Period: 2025-10-03 to 2025-11-02
|
|
277
|
+
Days analyzed: 30
|
|
278
|
+
============================================================
|
|
279
|
+
Total operational cost: $450,000.00
|
|
280
|
+
Daily operational: $14,516.13
|
|
281
|
+
Support (month): $15,000.00
|
|
282
|
+
Support per day (÷2÷days): $241.94
|
|
283
|
+
============================================================
|
|
284
|
+
DAILY RATE: $14,758.07
|
|
285
|
+
ANNUAL PROJECTION: $5,386,695
|
|
286
|
+
============================================================
|
|
287
|
+
```
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
aws_cost_calculator_cli-1.3.0.dist-info/licenses/LICENSE,sha256=cYtmQZHNGGTXOtg3T7LHDRneleaH0dHXHfxFV3WR50Y,1079
|
|
2
|
+
cost_calculator/__init__.py,sha256=PJeIqvWh5AYJVrJxPPkI4pJnAt37rIjasrNS0I87kaM,52
|
|
3
|
+
cost_calculator/cli.py,sha256=YJOWA-uWSMEZc4QHof8DF_An6VpKmTsxh0X_G31y1SM,31018
|
|
4
|
+
cost_calculator/drill.py,sha256=hGi-prLgZDvNMMICQc4fl3LenM7YaZ3To_Ei4LKwrdc,10543
|
|
5
|
+
cost_calculator/monthly.py,sha256=6k9F8S7djhX1wGV3-T1MZP7CvWbbfhSTEaddwCfVu5M,7932
|
|
6
|
+
cost_calculator/trends.py,sha256=k_s4ylBX50sqoiM_fwepi58HW01zz767FMJhQUPDznk,12246
|
|
7
|
+
aws_cost_calculator_cli-1.3.0.dist-info/METADATA,sha256=jZYbRF46p0qvjkw4Dqwja-4cnOJv59i7zTzmFXxfCsw,7761
|
|
8
|
+
aws_cost_calculator_cli-1.3.0.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
|
|
9
|
+
aws_cost_calculator_cli-1.3.0.dist-info/entry_points.txt,sha256=_5Qy4EcHbYVYrdgOu1E48faMHb9fLUl5VJ3djDHuJBo,47
|
|
10
|
+
aws_cost_calculator_cli-1.3.0.dist-info/top_level.txt,sha256=PRwGPPlNqASfyhGHDjSfyl4SXeE7GF3OVTu1tY1Uqyc,16
|
|
11
|
+
aws_cost_calculator_cli-1.3.0.dist-info/RECORD,,
|
|
@@ -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 @@
|
|
|
1
|
+
cost_calculator
|