aws-cost-calculator-cli 1.6.0__py3-none-any.whl → 1.9.1__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.

@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aws-cost-calculator-cli
3
- Version: 1.6.0
3
+ Version: 1.9.1
4
4
  Summary: AWS Cost Calculator CLI - Calculate daily and annual AWS costs across multiple accounts
5
- Home-page: https://github.com/yourusername/cost-calculator
5
+ Home-page: https://github.com/trilogy-group/aws-cost-calculator
6
6
  Author: Cost Optimization Team
7
7
  Author-email:
8
- Project-URL: Documentation, https://github.com/yourusername/cost-calculator/blob/main/README.md
8
+ Project-URL: Documentation, https://github.com/trilogy-group/aws-cost-calculator/blob/main/README.md
9
9
  Keywords: aws cost calculator billing optimization cloud
10
10
  Classifier: Development Status :: 4 - Beta
11
11
  Classifier: Intended Audience :: Developers
@@ -43,8 +43,12 @@ A CLI tool to quickly calculate AWS costs across multiple accounts.
43
43
  ## Installation
44
44
 
45
45
  ```bash
46
- cd ~/cost-calculator
47
- pip install -e .
46
+ pip install aws-cost-calculator-cli
47
+ ```
48
+
49
+ Or upgrade to the latest version:
50
+ ```bash
51
+ pip install --upgrade aws-cost-calculator-cli
48
52
  ```
49
53
 
50
54
  ## Quick Start
@@ -56,68 +60,193 @@ The CLI supports three authentication methods:
56
60
  #### 1. SSO (Recommended)
57
61
  ```bash
58
62
  # The CLI will automatically trigger SSO login if needed
59
- cc calculate --profile khoros --sso khoros_umbrella
63
+ cc calculate --profile myprofile --sso my_sso_profile
60
64
  ```
61
65
 
62
66
  #### 2. Static Credentials
63
67
  ```bash
64
- cc calculate --profile khoros \
65
- --access-key-id ASIA3D3QOXPO6EBAPXVI \
66
- --secret-access-key /9ijZEUoszN/S2A8IlCrHpW+1fMZ7aUb7fPvU0dL \
67
- --session-token IQoJb3JpZ2luX2VjENr...
68
+ cc calculate --profile myprofile \
69
+ --access-key-id ASIA... \
70
+ --secret-access-key ... \
71
+ --session-token ...
68
72
  ```
69
73
 
70
74
  #### 3. Environment Variables
71
75
  ```bash
72
76
  # For SSO
73
- export AWS_PROFILE=khoros_umbrella
74
- cc calculate --profile khoros
77
+ export AWS_PROFILE=my_sso_profile
78
+ cc calculate --profile myprofile
75
79
 
76
80
  # For static credentials
77
81
  export AWS_ACCESS_KEY_ID=ASIA...
78
82
  export AWS_SECRET_ACCESS_KEY=...
79
83
  export AWS_SESSION_TOKEN=...
80
- cc calculate --profile khoros
84
+ cc calculate --profile myprofile
81
85
  ```
82
86
 
83
87
  ### Basic Usage
84
88
 
85
89
  ```bash
86
90
  # Default: Today minus 2 days, going back 30 days
87
- cc calculate --profile khoros --sso khoros_umbrella
91
+ cc calculate --profile myprofile --sso my_sso_profile
88
92
 
89
93
  # Specific start date
90
- cc calculate --profile khoros --sso khoros_umbrella --start-date 2025-11-04
94
+ cc calculate --profile myprofile --sso my_sso_profile --start-date 2025-11-04
91
95
 
92
96
  # Custom offset and window
93
- cc calculate --profile khoros --sso khoros_umbrella --offset 2 --window 30
97
+ cc calculate --profile myprofile --sso my_sso_profile --offset 2 --window 30
94
98
 
95
99
  # JSON output
96
- cc calculate --profile khoros --sso khoros_umbrella --json-output
100
+ cc calculate --profile myprofile --sso my_sso_profile --json-output
97
101
  ```
98
102
 
99
103
  ### 4. Analyze cost trends
100
104
 
105
+ All commands support the same authentication options:
106
+
101
107
  ```bash
102
- # Analyze last 3 weeks (default)
108
+ # With SSO
109
+ cc trends --profile myprofile --sso my_sso_profile
110
+
111
+ # With static credentials
112
+ cc trends --profile myprofile --access-key-id ASIA... --secret-access-key ... --session-token ...
113
+
114
+ # With environment variables
115
+ export AWS_PROFILE=my_sso_profile
103
116
  cc trends --profile myprofile
104
117
 
105
118
  # Analyze more weeks
106
- cc trends --profile myprofile --weeks 5
119
+ cc trends --profile myprofile --sso my_sso_profile --weeks 5
107
120
 
108
121
  # Custom output file
109
- cc trends --profile myprofile --output weekly_trends.md
122
+ cc trends --profile myprofile --sso my_sso_profile --output weekly_trends.md
110
123
 
111
124
  # JSON output
112
- cc trends --profile myprofile --json-output
125
+ cc trends --profile myprofile --sso my_sso_profile --json-output
113
126
  ```
114
127
 
115
- ### 5. List profiles
128
+ ### 5. Monthly and drill-down analysis
129
+
130
+ ```bash
131
+ # Monthly trends
132
+ cc monthly --profile myprofile --sso my_sso_profile
133
+
134
+ # Drill down by service
135
+ cc drill --profile myprofile --sso my_sso_profile --service "EC2 - Other"
136
+
137
+ # Drill down by account
138
+ cc drill --profile myprofile --sso my_sso_profile --account 123456789012
139
+ ```
140
+
141
+ ### 6. List profiles
116
142
 
117
143
  ```bash
118
144
  cc list-profiles
119
145
  ```
120
146
 
147
+ ## Authentication
148
+
149
+ ### Overview
150
+
151
+ The CLI supports three authentication methods, all of which work with every command (`calculate`, `trends`, `monthly`, `drill`):
152
+
153
+ ### Method 1: SSO (Recommended)
154
+
155
+ The CLI automatically handles SSO login if your session has expired:
156
+
157
+ ```bash
158
+ cc calculate --profile myprofile --sso my_sso_profile
159
+ ```
160
+
161
+ **How it works:**
162
+ 1. CLI checks if SSO session is valid using `aws sts get-caller-identity`
163
+ 2. If expired, automatically runs `aws sso login --profile my_sso_profile`
164
+ 3. Opens browser for authentication
165
+ 4. Proceeds with cost calculation once authenticated
166
+
167
+ **Benefits:**
168
+ - No manual SSO login required
169
+ - Automatic session refresh
170
+ - Most secure method
171
+ - Works with AWS IAM Identity Center
172
+
173
+ ### Method 2: Static Credentials
174
+
175
+ Pass temporary credentials directly via CLI flags:
176
+
177
+ ```bash
178
+ cc calculate --profile myprofile \
179
+ --access-key-id ASIA... \
180
+ --secret-access-key ... \
181
+ --session-token ...
182
+ ```
183
+
184
+ **Use cases:**
185
+ - CI/CD pipelines
186
+ - Temporary credentials from STS
187
+ - Automated scripts
188
+ - When SSO is not available
189
+
190
+ ### Method 3: Environment Variables
191
+
192
+ Set credentials in your shell environment:
193
+
194
+ ```bash
195
+ # For SSO
196
+ export AWS_PROFILE=my_sso_profile
197
+ cc calculate --profile myprofile
198
+
199
+ # For static credentials
200
+ export AWS_ACCESS_KEY_ID=ASIA...
201
+ export AWS_SECRET_ACCESS_KEY=...
202
+ export AWS_SESSION_TOKEN=...
203
+ cc calculate --profile myprofile
204
+ ```
205
+
206
+ **Benefits:**
207
+ - No need to pass credentials with each command
208
+ - Works with existing AWS CLI configuration
209
+ - Can be set in shell profile (~/.zshrc, ~/.bashrc)
210
+
211
+ ### Profile Configuration
212
+
213
+ Profiles can be stored locally or fetched from a backend API:
214
+
215
+ **Local storage:** `~/.config/cost-calculator/profiles.json`
216
+ ```json
217
+ {
218
+ "myprofile": {
219
+ "accounts": ["123456789012", "234567890123", ...]
220
+ }
221
+ }
222
+ ```
223
+
224
+ **Backend API:** Set `COST_API_SECRET` environment variable
225
+
226
+ Quick setup (saves to shell profile):
227
+ ```bash
228
+ cc setup-api
229
+ # Enter your API secret when prompted (input will be hidden)
230
+ ```
231
+
232
+ **CUR Configuration (for --resources flag):**
233
+
234
+ To use resource-level queries, configure CUR settings:
235
+ ```bash
236
+ cc setup-cur
237
+ # Enter: Database name, table name, S3 output location
238
+ ```
239
+
240
+ This saves configuration to `~/.config/cost-calculator/cur_config.json`
241
+
242
+ Or set manually:
243
+ ```bash
244
+ export COST_API_SECRET="your-api-secret"
245
+ cc calculate --profile myprofile --sso my_sso_profile
246
+ ```
247
+
248
+ The CLI will automatically fetch profile configuration from the backend if `COST_API_SECRET` is set.
249
+
121
250
  ## How It Works
122
251
 
123
252
  ### Date Calculation
@@ -255,11 +384,13 @@ The `drill` command allows you to investigate cost changes at different levels o
255
384
  1. **Start broad:** `cc trends` → See EC2 costs up $1000
256
385
  2. **Drill by service:** `cc drill --service "EC2 - Other"` → See which accounts
257
386
  3. **Drill deeper:** `cc drill --service "EC2 - Other" --account 123` → See usage types
387
+ 4. **Resource-level:** `cc drill --service "EC2 - Other" --account 123 --resources` → See individual instance IDs
258
388
 
259
389
  **Features:**
260
390
  - **Week-over-week cost analysis**: Compare costs between consecutive weeks
261
391
  - **Month-over-month cost analysis**: Compare costs between consecutive months
262
392
  - **Drill-down analysis**: Analyze costs by service, account, or usage type
393
+ - **Resource-level analysis**: See individual resource IDs and costs using CUR data (NEW in v1.7.0)
263
394
  - **Pandas aggregations**: Time series analysis with sum, avg, std across all weeks
264
395
  - **Volatility detection**: Identify services with high cost variability and outliers
265
396
  - **Trend detection**: Auto-detect increasing/decreasing cost patterns
@@ -277,7 +408,7 @@ cc drill --profile myprofile --service "EC2 - Other"
277
408
  Showing top accounts:
278
409
  Week of Oct 19 → Week of Oct 26
279
410
  Increases: 3, Decreases: 2
280
- Top: 887649220066 (+$450.23)
411
+ Top: 123456789012 (+$450.23)
281
412
  ```
282
413
 
283
414
  The report is saved to `drill_down.md` by default.
@@ -0,0 +1,15 @@
1
+ aws_cost_calculator_cli-1.9.1.dist-info/licenses/LICENSE,sha256=cYtmQZHNGGTXOtg3T7LHDRneleaH0dHXHfxFV3WR50Y,1079
2
+ cost_calculator/__init__.py,sha256=PJeIqvWh5AYJVrJxPPkI4pJnAt37rIjasrNS0I87kaM,52
3
+ cost_calculator/api_client.py,sha256=4ZI2XcGIN3FBeQqb7xOxQ91kCoeM43-rExiOELXoKBQ,2485
4
+ cost_calculator/cli.py,sha256=IRlRxefn9rfrt6EWwSEcMi9HCISHuOfnUs2_Bf5IZkA,54085
5
+ cost_calculator/cur.py,sha256=QaZ_nyDSw5_cti-h5Ho6eYLbqzY5TWoub24DpyzIiSs,9502
6
+ cost_calculator/drill.py,sha256=hGi-prLgZDvNMMICQc4fl3LenM7YaZ3To_Ei4LKwrdc,10543
7
+ cost_calculator/executor.py,sha256=vZX3BCgTRHwBfxC0WqQsHgv1ww5rpmKqLCTrW2sflSY,6509
8
+ cost_calculator/forensics.py,sha256=uhRo3I_zOeMEaBENHfgq65URga31W0Z4vzS2UN6VmTY,12819
9
+ cost_calculator/monthly.py,sha256=6k9F8S7djhX1wGV3-T1MZP7CvWbbfhSTEaddwCfVu5M,7932
10
+ cost_calculator/trends.py,sha256=k_s4ylBX50sqoiM_fwepi58HW01zz767FMJhQUPDznk,12246
11
+ aws_cost_calculator_cli-1.9.1.dist-info/METADATA,sha256=jMNKiSSMAbMNajhVxBOyzSuJaWg3lrGfuCBSz0THo38,11978
12
+ aws_cost_calculator_cli-1.9.1.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
13
+ aws_cost_calculator_cli-1.9.1.dist-info/entry_points.txt,sha256=_5Qy4EcHbYVYrdgOu1E48faMHb9fLUl5VJ3djDHuJBo,47
14
+ aws_cost_calculator_cli-1.9.1.dist-info/top_level.txt,sha256=PRwGPPlNqASfyhGHDjSfyl4SXeE7GF3OVTu1tY1Uqyc,16
15
+ aws_cost_calculator_cli-1.9.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: setuptools (80.7.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -50,7 +50,8 @@ def call_lambda_api(endpoint, credentials, accounts, **kwargs):
50
50
  'monthly': 'https://6aueebodw6q4zdeu3aaexb6tle0fqhhr.lambda-url.us-east-1.on.aws/',
51
51
  'drill': 'https://3ncm2gzxrsyptrhud3ua3x5lju0akvsr.lambda-url.us-east-1.on.aws/',
52
52
  'analyze': 'https://y6npmidtxwzg62nrqzkbacfs5q0edwgs.lambda-url.us-east-1.on.aws/',
53
- 'profiles': 'https://64g7jq7sjygec2zmll5lsghrpi0txrzo.lambda-url.us-east-1.on.aws/'
53
+ 'profiles': 'https://64g7jq7sjygec2zmll5lsghrpi0txrzo.lambda-url.us-east-1.on.aws/',
54
+ 'forensics': 'https://gaekfzz7sc2hwn4mjyk64sieke0vadfo.lambda-url.us-east-1.on.aws/' # Will be populated after deployment
54
55
  }
55
56
 
56
57
  url = endpoint_urls.get(endpoint)