aws-cost-calculator-cli 1.6.2__py3-none-any.whl → 2.4.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.
- {aws_cost_calculator_cli-1.6.2.dist-info → aws_cost_calculator_cli-2.4.0.dist-info}/METADATA +31 -12
- aws_cost_calculator_cli-2.4.0.dist-info/RECORD +16 -0
- {aws_cost_calculator_cli-1.6.2.dist-info → aws_cost_calculator_cli-2.4.0.dist-info}/top_level.txt +0 -1
- cost_calculator/api_client.py +18 -20
- cost_calculator/cli.py +1750 -249
- cost_calculator/cur.py +244 -0
- cost_calculator/dimensions.py +141 -0
- cost_calculator/executor.py +124 -101
- cost_calculator/forensics.py +323 -0
- aws_cost_calculator_cli-1.6.2.dist-info/RECORD +0 -25
- backend/__init__.py +0 -1
- backend/algorithms/__init__.py +0 -1
- backend/algorithms/analyze.py +0 -272
- backend/algorithms/drill.py +0 -323
- backend/algorithms/monthly.py +0 -242
- backend/algorithms/trends.py +0 -353
- backend/handlers/__init__.py +0 -1
- backend/handlers/analyze.py +0 -112
- backend/handlers/drill.py +0 -117
- backend/handlers/monthly.py +0 -106
- backend/handlers/profiles.py +0 -148
- backend/handlers/trends.py +0 -106
- {aws_cost_calculator_cli-1.6.2.dist-info → aws_cost_calculator_cli-2.4.0.dist-info}/WHEEL +0 -0
- {aws_cost_calculator_cli-1.6.2.dist-info → aws_cost_calculator_cli-2.4.0.dist-info}/entry_points.txt +0 -0
- {aws_cost_calculator_cli-1.6.2.dist-info → aws_cost_calculator_cli-2.4.0.dist-info}/licenses/LICENSE +0 -0
{aws_cost_calculator_cli-1.6.2.dist-info → aws_cost_calculator_cli-2.4.0.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aws-cost-calculator-cli
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.4.0
|
|
4
4
|
Summary: AWS Cost Calculator CLI - Calculate daily and annual AWS costs across multiple accounts
|
|
5
5
|
Home-page: https://github.com/trilogy-group/aws-cost-calculator
|
|
6
6
|
Author: Cost Optimization Team
|
|
@@ -210,23 +210,40 @@ cc calculate --profile myprofile
|
|
|
210
210
|
|
|
211
211
|
### Profile Configuration
|
|
212
212
|
|
|
213
|
-
|
|
213
|
+
**v2.3.0+: API-Only Architecture**
|
|
214
214
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
215
|
+
All profiles are now managed via backend API (DynamoDB). No local profile files are used.
|
|
216
|
+
|
|
217
|
+
**Setup:**
|
|
218
|
+
```bash
|
|
219
|
+
# Configure API secret (one-time setup)
|
|
220
|
+
cc configure --api-secret YOUR_SECRET
|
|
221
|
+
|
|
222
|
+
# Or set environment variable
|
|
223
|
+
export COST_API_SECRET=your_secret_here
|
|
222
224
|
```
|
|
223
225
|
|
|
224
|
-
**
|
|
226
|
+
**List available profiles:**
|
|
225
227
|
```bash
|
|
226
|
-
|
|
227
|
-
cc calculate --profile myprofile --sso my_sso_profile
|
|
228
|
+
cc list-profiles
|
|
228
229
|
```
|
|
229
230
|
|
|
231
|
+
**How it works:**
|
|
232
|
+
1. CLI gets AWS credentials from SSO/environment
|
|
233
|
+
2. CLI sends request to `https://api.costcop.cloudfix.dev` with:
|
|
234
|
+
- Profile name (e.g., "khoros")
|
|
235
|
+
- Your AWS credentials
|
|
236
|
+
3. Backend Lambda loads profile from DynamoDB (accounts, exclusions, Athena config)
|
|
237
|
+
4. Backend executes AWS API calls using your credentials
|
|
238
|
+
5. Results returned to CLI for formatting
|
|
239
|
+
|
|
240
|
+
**Benefits:**
|
|
241
|
+
- No local configuration files to maintain
|
|
242
|
+
- Centralized profile management
|
|
243
|
+
- Automatic exclusions (Tax, Support, etc.)
|
|
244
|
+
- Profile updates apply immediately to all users
|
|
245
|
+
- Athena CUR configuration managed centrally
|
|
246
|
+
|
|
230
247
|
The CLI will automatically fetch profile configuration from the backend if `COST_API_SECRET` is set.
|
|
231
248
|
|
|
232
249
|
## How It Works
|
|
@@ -366,11 +383,13 @@ The `drill` command allows you to investigate cost changes at different levels o
|
|
|
366
383
|
1. **Start broad:** `cc trends` → See EC2 costs up $1000
|
|
367
384
|
2. **Drill by service:** `cc drill --service "EC2 - Other"` → See which accounts
|
|
368
385
|
3. **Drill deeper:** `cc drill --service "EC2 - Other" --account 123` → See usage types
|
|
386
|
+
4. **Resource-level:** `cc drill --service "EC2 - Other" --account 123 --resources` → See individual instance IDs
|
|
369
387
|
|
|
370
388
|
**Features:**
|
|
371
389
|
- **Week-over-week cost analysis**: Compare costs between consecutive weeks
|
|
372
390
|
- **Month-over-month cost analysis**: Compare costs between consecutive months
|
|
373
391
|
- **Drill-down analysis**: Analyze costs by service, account, or usage type
|
|
392
|
+
- **Resource-level analysis**: See individual resource IDs and costs using CUR data (NEW in v1.7.0)
|
|
374
393
|
- **Pandas aggregations**: Time series analysis with sum, avg, std across all weeks
|
|
375
394
|
- **Volatility detection**: Identify services with high cost variability and outliers
|
|
376
395
|
- **Trend detection**: Auto-detect increasing/decreasing cost patterns
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
aws_cost_calculator_cli-2.4.0.dist-info/licenses/LICENSE,sha256=cYtmQZHNGGTXOtg3T7LHDRneleaH0dHXHfxFV3WR50Y,1079
|
|
2
|
+
cost_calculator/__init__.py,sha256=PJeIqvWh5AYJVrJxPPkI4pJnAt37rIjasrNS0I87kaM,52
|
|
3
|
+
cost_calculator/api_client.py,sha256=UN_dKo8OYWVN905xZAn8pLlHMBSFR_EJWCUq21K8IKg,2204
|
|
4
|
+
cost_calculator/cli.py,sha256=eFk3sjNBdupZHlivhWSpxAWZluDyzX-OHM_EycfJrbk,98144
|
|
5
|
+
cost_calculator/cur.py,sha256=QaZ_nyDSw5_cti-h5Ho6eYLbqzY5TWoub24DpyzIiSs,9502
|
|
6
|
+
cost_calculator/dimensions.py,sha256=cTpdYm-w88IgqlcB4ObhUsvGREBMrMSZx0d2PyehI6M,4478
|
|
7
|
+
cost_calculator/drill.py,sha256=hGi-prLgZDvNMMICQc4fl3LenM7YaZ3To_Ei4LKwrdc,10543
|
|
8
|
+
cost_calculator/executor.py,sha256=vwp4SoZfTobUeTKPujRzZzkO7tjOG8_LEGxgtraOZAQ,9348
|
|
9
|
+
cost_calculator/forensics.py,sha256=uhRo3I_zOeMEaBENHfgq65URga31W0Z4vzS2UN6VmTY,12819
|
|
10
|
+
cost_calculator/monthly.py,sha256=6k9F8S7djhX1wGV3-T1MZP7CvWbbfhSTEaddwCfVu5M,7932
|
|
11
|
+
cost_calculator/trends.py,sha256=k_s4ylBX50sqoiM_fwepi58HW01zz767FMJhQUPDznk,12246
|
|
12
|
+
aws_cost_calculator_cli-2.4.0.dist-info/METADATA,sha256=CF6_PkZ3eigTW-F6uKHaCtztSCqu_tnKN8Z9FzSTVS4,12160
|
|
13
|
+
aws_cost_calculator_cli-2.4.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
+
aws_cost_calculator_cli-2.4.0.dist-info/entry_points.txt,sha256=_5Qy4EcHbYVYrdgOu1E48faMHb9fLUl5VJ3djDHuJBo,47
|
|
15
|
+
aws_cost_calculator_cli-2.4.0.dist-info/top_level.txt,sha256=PRwGPPlNqASfyhGHDjSfyl4SXeE7GF3OVTu1tY1Uqyc,16
|
|
16
|
+
aws_cost_calculator_cli-2.4.0.dist-info/RECORD,,
|
cost_calculator/api_client.py
CHANGED
|
@@ -23,14 +23,15 @@ def get_api_config():
|
|
|
23
23
|
return None
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
def call_lambda_api(endpoint, credentials, accounts, **kwargs):
|
|
26
|
+
def call_lambda_api(endpoint, credentials, accounts=None, profile=None, **kwargs):
|
|
27
27
|
"""
|
|
28
|
-
Call
|
|
28
|
+
Call unified API Gateway endpoint.
|
|
29
29
|
|
|
30
30
|
Args:
|
|
31
|
-
endpoint: API endpoint name ('trends', 'monthly', 'drill')
|
|
31
|
+
endpoint: API endpoint name ('calculate', 'trends', 'monthly', 'drill', 'query', etc.)
|
|
32
32
|
credentials: dict with AWS credentials
|
|
33
|
-
accounts: list of account IDs
|
|
33
|
+
accounts: list of account IDs (deprecated - use profile instead)
|
|
34
|
+
profile: profile name (preferred over accounts)
|
|
34
35
|
**kwargs: additional parameters for the specific endpoint
|
|
35
36
|
|
|
36
37
|
Returns:
|
|
@@ -44,25 +45,22 @@ def call_lambda_api(endpoint, credentials, accounts, **kwargs):
|
|
|
44
45
|
if not api_config:
|
|
45
46
|
raise Exception("API not configured. Set COST_API_SECRET environment variable.")
|
|
46
47
|
|
|
47
|
-
#
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
'monthly': 'https://6aueebodw6q4zdeu3aaexb6tle0fqhhr.lambda-url.us-east-1.on.aws/',
|
|
51
|
-
'drill': 'https://3ncm2gzxrsyptrhud3ua3x5lju0akvsr.lambda-url.us-east-1.on.aws/',
|
|
52
|
-
'analyze': 'https://y6npmidtxwzg62nrqzkbacfs5q0edwgs.lambda-url.us-east-1.on.aws/',
|
|
53
|
-
'profiles': 'https://64g7jq7sjygec2zmll5lsghrpi0txrzo.lambda-url.us-east-1.on.aws/'
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
url = endpoint_urls.get(endpoint)
|
|
57
|
-
|
|
58
|
-
if not url:
|
|
59
|
-
raise Exception(f"Unknown endpoint: {endpoint}")
|
|
48
|
+
# Get base URL from environment or use default
|
|
49
|
+
base_url = os.environ.get('COST_CALCULATOR_API_URL', 'https://api.costcop.cloudfix.dev')
|
|
50
|
+
url = f"{base_url}/{endpoint}"
|
|
60
51
|
|
|
61
52
|
# Build request payload
|
|
62
53
|
payload = {
|
|
63
|
-
'credentials': credentials
|
|
64
|
-
'accounts': accounts
|
|
54
|
+
'credentials': credentials
|
|
65
55
|
}
|
|
56
|
+
|
|
57
|
+
# Add profile or accounts
|
|
58
|
+
if profile:
|
|
59
|
+
payload['profile'] = profile
|
|
60
|
+
elif accounts:
|
|
61
|
+
payload['accounts'] = accounts
|
|
62
|
+
|
|
63
|
+
# Add additional parameters
|
|
66
64
|
payload.update(kwargs)
|
|
67
65
|
|
|
68
66
|
# Make API call
|
|
@@ -71,7 +69,7 @@ def call_lambda_api(endpoint, credentials, accounts, **kwargs):
|
|
|
71
69
|
'Content-Type': 'application/json'
|
|
72
70
|
}
|
|
73
71
|
|
|
74
|
-
response = requests.post(url, headers=headers, json=payload, timeout=
|
|
72
|
+
response = requests.post(url, headers=headers, json=payload, timeout=900) # 15 min timeout
|
|
75
73
|
|
|
76
74
|
if response.status_code != 200:
|
|
77
75
|
raise Exception(f"API call failed: {response.status_code} - {response.text}")
|