cloud-cost-cli 0.1.0 → 0.2.0

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.
package/README.md CHANGED
@@ -1,8 +1,11 @@
1
1
  # cloud-cost-cli
2
2
 
3
+ [![npm version](https://badge.fury.io/js/cloud-cost-cli.svg)](https://www.npmjs.com/package/cloud-cost-cli)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
3
6
  **Optimize your cloud spend in seconds.**
4
7
 
5
- A command-line tool that analyzes your AWS, GCP, and Azure bills to identify cost-saving opportunities — idle resources, oversized instances, unattached volumes, and more.
8
+ A command-line tool that analyzes your AWS and Azure resources to identify cost-saving opportunities — idle resources, oversized instances, unattached volumes, and more.
6
9
 
7
10
  ---
8
11
 
@@ -15,157 +18,140 @@ Cloud bills are growing faster than revenue. Engineering teams overprovision, fo
15
18
  `cloud-cost-cli` connects to your cloud accounts, analyzes resource usage and billing data, and outputs a ranked list of actionable savings opportunities — all in your terminal, in under 60 seconds.
16
19
 
17
20
  **What it finds:**
18
- - Idle EC2/Compute instances (low CPU, stopped but still billed)
19
- - Unattached EBS volumes and snapshots
20
- - Oversized RDS/database instances
21
+ - Idle VMs/EC2 instances (low CPU, stopped but still billed)
22
+ - Unattached volumes, disks, and snapshots
23
+ - Oversized database instances (RDS, Azure SQL)
21
24
  - Old load balancers with no traffic
22
- - Unused Elastic IPs
23
- - Underutilized reserved instances or savings plan mismatches
24
- - Redundant S3 storage (lifecycle policies missing)
25
+ - Unused public IP addresses
26
+ - Underutilized resources that can be downsized
27
+ - Storage without lifecycle policies
25
28
 
26
29
  ---
27
30
 
28
- ## Features (MVP - Week 1–2)
29
-
30
- - ✅ AWS support (EC2, EBS, RDS, S3, ELB, Elastic IP)
31
- - ✅ Connect via AWS credentials (IAM read-only recommended)
32
- - ✅ Analyze last 30 days of usage
33
- - ✅ Output top 5 savings opportunities with estimated monthly savings
34
- - ✅ Export report as JSON, Markdown, or terminal table
35
- - ✅ Zero third-party API dependencies (uses AWS SDK directly)
36
-
37
- **Coming soon:**
38
- - GCP and Azure support
39
- - Slack/email alerts for new cost spikes
40
- - Scheduled reports (cron-friendly)
41
- - Team dashboard (web UI, SaaS)
42
- - Custom rules and thresholds
43
- - Terraform/IaC integration (flag risky configs before apply)
31
+ ## Features
32
+
33
+ **Current capabilities:**
34
+ - ✅ **Multi-cloud support** - AWS and Azure
35
+ - ✅ **AWS analyzers** - EC2, EBS, RDS, S3, ELB, Elastic IP
36
+ - ✅ **Azure analyzers** - VMs, Managed Disks, Storage, SQL, Public IPs
37
+ - ✅ Connect via cloud credentials (read-only recommended)
38
+ - ✅ Analyze last 7-30 days of usage
39
+ - ✅ Output top savings opportunities with estimated monthly savings
40
+ - ✅ Export report as JSON or terminal table
41
+ - Filter by minimum savings amount
42
+ - Comprehensive test suite (84 tests)
43
+
44
+ **Potential future additions:**
45
+ - GCP support (Compute Engine, Cloud Storage, Cloud SQL)
46
+ - Real-time pricing API integration
47
+ - Configuration file support
48
+ - Additional AWS services (Lambda, DynamoDB, CloudFront, etc.)
49
+ - Additional Azure services (App Services, CosmosDB, etc.)
50
+ - Multi-region analysis
51
+ - Historical cost tracking
52
+ - Scheduled scans and notifications
53
+ - CI/CD integration examples
54
+ - Custom analyzer rules
55
+
56
+ No commitment on timeline - contributions welcome!
44
57
 
45
58
  ---
46
59
 
47
60
  ## Installation
48
61
 
49
62
  **Requirements:**
50
- - Node.js >= 18 (or use the standalone binary)
51
- - AWS credentials configured (see [AWS CLI setup](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html))
63
+ - Node.js >= 18
64
+ - Cloud credentials:
65
+ - **AWS**: [AWS CLI configured](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) or environment variables
66
+ - **Azure**: [Azure CLI logged in](https://learn.microsoft.com/en-us/cli/azure/authenticate-azure-cli) or environment variables
52
67
 
53
68
  **Install via npm:**
54
69
  ```bash
55
70
  npm install -g cloud-cost-cli
56
71
  ```
57
72
 
58
- **Or download standalone binary:**
59
- ```bash
60
- # macOS/Linux
61
- curl -L https://github.com/vuhp/cloud-cost-cli/releases/latest/download/cloud-cost-cli-$(uname -s)-$(uname -m) -o /usr/local/bin/cloud-cost-cli
62
- chmod +x /usr/local/bin/cloud-cost-cli
73
+ ---
63
74
 
64
- # Windows (PowerShell)
65
- Invoke-WebRequest -Uri "https://github.com/vuhp/cloud-cost-cli/releases/latest/download/cloud-cost-cli-windows-x64.exe" -OutFile "$env:USERPROFILE\bin\cloud-cost-cli.exe"
75
+ ## Usage
76
+
77
+ **AWS scan:**
78
+ ```bash
79
+ cloud-cost-cli scan --provider aws --profile default --region us-east-1
66
80
  ```
67
81
 
68
- ---
82
+ **Azure scan:**
83
+ ```bash
84
+ # Set Azure subscription ID (or use --subscription-id flag)
85
+ export AZURE_SUBSCRIPTION_ID="your-subscription-id"
69
86
 
70
- ## Usage
87
+ cloud-cost-cli scan --provider azure --location eastus
88
+ ```
71
89
 
72
- **Basic scan (AWS):**
90
+ **Show more opportunities:**
73
91
  ```bash
74
- cloud-cost-cli scan --provider aws --profile default
92
+ cloud-cost-cli scan --provider aws --top 20 # Show top 20 instead of default 5
75
93
  ```
76
94
 
77
- **Specify region and output format:**
95
+ **Filter by minimum savings:**
78
96
  ```bash
79
- cloud-cost-cli scan --provider aws --region us-east-1 --output json > report.json
97
+ cloud-cost-cli scan --provider azure --min-savings 50 # Only show opportunities > $50/month
80
98
  ```
81
99
 
82
- **Top N opportunities:**
100
+ **Specify output format:**
83
101
  ```bash
84
- cloud-cost-cli scan --provider aws --top 10
102
+ cloud-cost-cli scan --provider aws --output json > report.json
85
103
  ```
86
104
 
87
105
  **Example output:**
88
106
  ```
89
107
  Cloud Cost Optimization Report
90
- Provider: AWS | Region: us-east-1 | Account: 123456789012
108
+ Provider: AWS | Region: us-east-1 | Account: N/A
91
109
  Analyzed: 2026-01-01 to 2026-01-31
92
110
 
93
111
  Top 5 Savings Opportunities (est. $1,245/month):
94
112
 
95
- 1. Idle EC2 instance: i-0abc123def456
96
- Type: m5.large | Running 720h | Avg CPU: 2%
97
- → Recommendation: Stop or downsize to t3.small
98
- Est. savings: $65/month
99
-
100
- 2. Unattached EBS volume: vol-0xyz789abc
101
- Size: 500 GB (gp3) | Age: 45 days
102
- Recommendation: Delete or snapshot + delete
103
- → Est. savings: $40/month
104
-
105
- 3. Oversized RDS instance: mydb-production
106
- Type: db.r5.xlarge | Avg connections: 5 | Avg CPU: 15%
107
- → Recommendation: Downsize to db.t3.large
108
- → Est. savings: $180/month
113
+ ┌───┬──────────┬────────────────────────────────────────┬──────────────────────────────────────────────────────────┬─────────────┐
114
+ # Type │ Resource ID │ Recommendation │ Savings/mo │
115
+ ├───┼──────────┼────────────────────────────────────────┼──────────────────────────────────────────────────────────┼─────────────┤
116
+ 1 │ EC2 │ i-0abc123def456 │ Stop idle instance (CPU: 2%) │ $65.00 │
117
+ ├───┼──────────┼────────────────────────────────────────┼──────────────────────────────────────────────────────────┼─────────────┤
118
+ 2 EBS vol-0xyz789abc │ Delete unattached volume (500 GB) │ $40.00 │
119
+ ├───┼──────────┼────────────────────────────────────────┼──────────────────────────────────────────────────────────┼─────────────┤
120
+ 3 RDS │ mydb-production │ Downsize from db.r5.xlarge to db.t3.large (CPU: 15%) │ $180.00 │
121
+ ├───┼──────────┼────────────────────────────────────────┼──────────────────────────────────────────────────────────┼─────────────┤
122
+ │ 4 │ ELB │ my-old-alb │ Delete unused load balancer │ $22.00 │
123
+ ├───┼──────────┼────────────────────────────────────────┼──────────────────────────────────────────────────────────┼─────────────┤
124
+ 5 S3 │ logs-bucket-2023 │ Add lifecycle policy to transition to Glacier │ $938.00 │
125
+ └───┴──────────┴────────────────────────────────────────┴──────────────────────────────────────────────────────────┴─────────────┘
109
126
 
110
- 4. Unused Elastic Load Balancer: my-old-alb
111
- Active targets: 0 | Requests/day: 0
112
- → Recommendation: Delete
113
- → Est. savings: $22/month
127
+ Total potential savings: $1,245/month ($14,940/year)
114
128
 
115
- 5. S3 bucket with no lifecycle policy: logs-bucket-2023
116
- Size: 12 TB | Age: 18 months
117
- → Recommendation: Enable Intelligent-Tiering or Glacier transition
118
- → Est. savings: $938/month
129
+ Summary: 47 resources analyzed | 12 idle | 8 oversized | 5 unused
119
130
 
120
- Total potential savings: $1,245/month ($14,940/year)
131
+ 💡 Note: Cost estimates based on us-east-1 pricing and may vary by region.
132
+ For more accurate estimates, actual costs depend on your usage and region.
121
133
  ```
122
134
 
123
135
  ---
124
136
 
125
- ## Configuration
126
-
127
- Create a config file at `~/.cloud-cost-cli/config.json` (optional):
128
-
129
- ```json
130
- {
131
- "aws": {
132
- "profile": "default",
133
- "regions": ["us-east-1", "us-west-2"],
134
- "excludeResources": ["i-0abc123", "vol-xyz"],
135
- "thresholds": {
136
- "idleCpuPercent": 5,
137
- "minAgeDays": 7
138
- }
139
- },
140
- "output": {
141
- "format": "table",
142
- "includeRecommendations": true
143
- }
144
- }
145
- ```
137
+ ## Pricing Estimates
146
138
 
147
- ---
139
+ **How cost estimates work:**
148
140
 
149
- ## Roadmap
141
+ Cost savings are estimated using AWS on-demand pricing for **us-east-1** (January 2026). These are approximations to help you prioritize optimization efforts.
150
142
 
151
- **Phase 1 (Week 1–2): MVP**
152
- - AWS support (EC2, EBS, RDS, S3, ELB, EIP)
153
- - CLI with basic scan and reporting
154
- - GitHub Sponsors setup
155
- - Launch on Hacker News, Product Hunt, Reddit
143
+ **Important notes:**
144
+ - 💵 Actual costs vary by region (e.g., ap-southeast-1 may be 10-15% higher)
145
+ - 📊 Estimates don't include Reserved Instances, Savings Plans, or spot discounts
146
+ - 🔄 AWS pricing changes periodically
147
+ - ⚙️ Additional costs like data transfer and storage operations not included
156
148
 
157
- **Phase 2 (Month 2):**
158
- - GCP support
159
- - Azure support
160
- - Scheduled reports (cron mode)
161
- - Slack webhook integration
162
- - GitHub Sponsors perks (early access, priority support)
149
+ **For the most accurate estimates:**
150
+ - Cross-reference with your AWS Cost Explorer or Azure Cost Management
151
+ - Consider estimates as directional guidance, not exact amounts
152
+ - Real-time pricing API integration coming in a future release
163
153
 
164
- **Phase 3 (Month 3+):**
165
- - SaaS version: connect account, weekly email reports, team dashboard
166
- - Paid tiers: $29/mo (alerts + history), $99/mo (multi-account + API)
167
- - Enterprise: on-prem, SSO, audit logs, custom rules
168
- - Terraform provider (flag cost risks before apply)
154
+ The goal is to help you find waste quickly — even if estimates are ±20%, you'll still identify significant savings opportunities.
169
155
 
170
156
  ---
171
157
 
@@ -178,25 +164,33 @@ Contributions welcome! Please open an issue before submitting large PRs.
178
164
  git clone https://github.com/vuhp/cloud-cost-cli.git
179
165
  cd cloud-cost-cli
180
166
  npm install
181
- npm run dev
167
+ npm run build
182
168
  ```
183
169
 
184
170
  **Run tests:**
185
171
  ```bash
186
- npm test
172
+ npm test # Run all tests
173
+ npm run test:coverage # Run with coverage report
174
+ npm run test:ui # Interactive UI
175
+ ```
176
+
177
+ **Development workflow:**
178
+ ```bash
179
+ npm run dev -- scan --provider aws --profile your-profile # Test locally
180
+ npm run build # Compile TypeScript
187
181
  ```
188
182
 
189
183
  ---
190
184
 
191
- ## Sponsorship
185
+ ## Support This Project
192
186
 
193
- If this tool saves you money, consider sponsoring development via [GitHub Sponsors](https://github.com/sponsors/vuhp).
187
+ If cloud-cost-cli helps you save money, consider [sponsoring on GitHub](https://github.com/sponsors/vuhp).
194
188
 
195
- **Sponsor tiers:**
196
- - $5/mo: Thank you!
197
- - 🚀 $25/mo: Early access to new features + priority support
198
- - 💼 $100/mo: Logo on README + monthly 1:1 consultation (30 min)
199
- - 🏢 $500/mo: Custom rule development + dedicated Slack channel
189
+ Your support helps fund:
190
+ - 🚀 New cloud provider integrations
191
+ - 🐛 Bug fixes and maintenance
192
+ - 📚 Better documentation
193
+ - Community feature requests
200
194
 
201
195
  ---
202
196
 
@@ -208,27 +202,30 @@ MIT License - see [LICENSE](LICENSE)
208
202
 
209
203
  ## Credits
210
204
 
211
- **Powered by:**
212
- - AWS SDK for JavaScript
213
- - Commander.js
214
- - Chalk (terminal colors)
215
- - Table (terminal tables)
205
+ **Built with:**
206
+ - [AWS SDK for JavaScript v3](https://aws.amazon.com/sdk-for-javascript/) - AWS cloud APIs
207
+ - [Azure SDK for JavaScript](https://azure.github.io/azure-sdk-for-js/) - Azure cloud APIs
208
+ - [Commander.js](https://github.com/tj/commander.js) - CLI framework
209
+ - [cli-table3](https://github.com/cli-table/cli-table3) - Terminal tables
210
+ - [Chalk](https://github.com/chalk/chalk) - Terminal styling
216
211
 
217
212
  ---
218
213
 
219
214
  ## FAQ
220
215
 
221
216
  **Q: Does this tool make changes to my infrastructure?**
222
- A: No. It only reads billing and usage data. It never modifies or deletes resources.
217
+ A: No. It only reads resource metadata and usage metrics. It never modifies or deletes resources.
223
218
 
224
- **Q: What IAM permissions are required?**
225
- A: Read-only permissions for Cost Explorer, EC2, EBS, RDS, S3, ELB. See [IAM policy template](docs/iam-policy.json).
219
+ **Q: What permissions are required?**
220
+ A: Read-only permissions for each cloud provider:
221
+ - **AWS**: EC2, EBS, RDS, S3, ELB, CloudWatch (see [AWS permissions](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html))
222
+ - **Azure**: Reader role on subscription or resource groups
226
223
 
227
224
  **Q: How accurate are the savings estimates?**
228
- A: Estimates are based on current pricing and usage patterns. Actual savings may vary.
225
+ A: Estimates are based on current pricing and usage patterns. Actual savings may vary by region and your specific pricing agreements (Reserved Instances, Savings Plans, etc.).
229
226
 
230
227
  **Q: Can I run this in CI/CD?**
231
- A: Yes. Use `--output json` and fail the build if savings exceed a threshold.
228
+ A: Yes. Use `--output json` and parse the results to fail builds if savings exceed a threshold.
232
229
 
233
230
  ---
234
231
 
@@ -11,13 +11,16 @@ program
11
11
  program
12
12
  .command('scan')
13
13
  .description('Scan cloud account for cost savings')
14
- .option('--provider <aws|gcp|azure>', 'Cloud provider', 'aws')
15
- .option('--region <region>', 'Cloud region (e.g., us-east-1)')
14
+ .option('--provider <aws|azure>', 'Cloud provider', 'aws')
15
+ .option('--region <region>', 'AWS region (e.g., us-east-1)')
16
16
  .option('--profile <profile>', 'AWS profile name', 'default')
17
+ .option('--subscription-id <id>', 'Azure subscription ID')
18
+ .option('--location <location>', 'Azure location filter (e.g., eastus, westus2) - optional, scans all if omitted')
17
19
  .option('--top <N>', 'Show top N opportunities', '5')
18
20
  .option('--output <table|json|markdown>', 'Output format', 'table')
19
21
  .option('--days <N>', 'Analysis period in days', '30')
20
22
  .option('--min-savings <amount>', 'Filter by minimum savings ($/month)')
23
+ .option('--accurate', 'Use real-time pricing from AWS (slower but more accurate)')
21
24
  .option('--verbose', 'Verbose logging')
22
25
  .action(scan_js_1.scanCommand);
23
26
  program.parse();
@@ -13,6 +13,20 @@ export declare const ELB_PRICING: {
13
13
  clb: number;
14
14
  };
15
15
  export declare const EIP_PRICING_HOURLY = 0.005;
16
+ /**
17
+ * Cost estimator with support for both estimate and accurate modes
18
+ */
19
+ export declare class CostEstimator {
20
+ private pricingService?;
21
+ private useAccuratePricing;
22
+ constructor(region: string, accurate?: boolean);
23
+ getEC2MonthlyCost(instanceType: string): Promise<number>;
24
+ getEBSMonthlyCost(sizeGB: number, volumeType: string): Promise<number>;
25
+ getRDSMonthlyCost(instanceClass: string, engine?: string): Promise<number>;
26
+ getS3MonthlyCost(sizeGB: number, storageClass?: string): number;
27
+ getELBMonthlyCost(type?: 'alb' | 'nlb' | 'clb'): number;
28
+ getEIPMonthlyCost(): number;
29
+ }
16
30
  export declare function getEC2MonthlyCost(instanceType: string): number;
17
31
  export declare function getEBSMonthlyCost(sizeGB: number, volumeType: string): number;
18
32
  export declare function getRDSMonthlyCost(instanceClass: string): number;
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
- // EC2 instance pricing (us-east-1, Linux, on-demand, monthly estimate)
3
- // Source: AWS pricing as of 2026-01, monthly = hourly × 730
4
2
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.EIP_PRICING_HOURLY = exports.ELB_PRICING = exports.S3_PRICING = exports.RDS_PRICING = exports.EBS_PRICING = exports.EC2_PRICING = void 0;
3
+ exports.CostEstimator = exports.EIP_PRICING_HOURLY = exports.ELB_PRICING = exports.S3_PRICING = exports.RDS_PRICING = exports.EBS_PRICING = exports.EC2_PRICING = void 0;
6
4
  exports.getEC2MonthlyCost = getEC2MonthlyCost;
7
5
  exports.getEBSMonthlyCost = getEBSMonthlyCost;
8
6
  exports.getRDSMonthlyCost = getRDSMonthlyCost;
9
7
  exports.getS3MonthlyCost = getS3MonthlyCost;
10
8
  exports.getELBMonthlyCost = getELBMonthlyCost;
11
9
  exports.getEIPMonthlyCost = getEIPMonthlyCost;
10
+ const pricing_service_1 = require("./pricing-service");
11
+ // Fallback pricing estimates (based on us-east-1, Jan 2026)
12
+ // Used when --accurate flag is not set or Pricing API fails
12
13
  exports.EC2_PRICING = {
13
14
  't2.micro': 8.47,
14
15
  't2.small': 16.79,
@@ -28,7 +29,6 @@ exports.EC2_PRICING = {
28
29
  'r5.large': 91.25,
29
30
  'r5.xlarge': 182.50,
30
31
  };
31
- // EBS pricing (us-east-1, per GB/month)
32
32
  exports.EBS_PRICING = {
33
33
  gp3: 0.08,
34
34
  gp2: 0.10,
@@ -37,7 +37,6 @@ exports.EBS_PRICING = {
37
37
  st1: 0.045,
38
38
  sc1: 0.015,
39
39
  };
40
- // RDS pricing (us-east-1, per month)
41
40
  exports.RDS_PRICING = {
42
41
  'db.t3.micro': 11.01,
43
42
  'db.t3.small': 22.63,
@@ -49,30 +48,89 @@ exports.RDS_PRICING = {
49
48
  'db.r5.xlarge': 350.40,
50
49
  'db.r5.2xlarge': 700.80,
51
50
  };
52
- // S3 pricing (per GB/month)
53
51
  exports.S3_PRICING = {
54
52
  standard: 0.023,
55
- intelligentTiering: 0.023, // same base, but auto-transitions
53
+ intelligentTiering: 0.023,
56
54
  glacier: 0.004,
57
55
  glacierDeepArchive: 0.00099,
58
56
  };
59
- // ELB pricing (per month, excluding LCU charges)
60
57
  exports.ELB_PRICING = {
61
- alb: 16.43, // Application Load Balancer
62
- nlb: 16.43, // Network Load Balancer
63
- clb: 18.25, // Classic Load Balancer
58
+ alb: 16.43,
59
+ nlb: 16.43,
60
+ clb: 18.25,
64
61
  };
65
- // Elastic IP pricing (per hour when not associated)
66
- exports.EIP_PRICING_HOURLY = 0.005; // ~$3.65/month
62
+ exports.EIP_PRICING_HOURLY = 0.005;
63
+ /**
64
+ * Cost estimator with support for both estimate and accurate modes
65
+ */
66
+ class CostEstimator {
67
+ pricingService;
68
+ useAccuratePricing;
69
+ constructor(region, accurate = false) {
70
+ this.useAccuratePricing = accurate;
71
+ if (accurate) {
72
+ this.pricingService = new pricing_service_1.PricingService(region);
73
+ }
74
+ }
75
+ async getEC2MonthlyCost(instanceType) {
76
+ if (this.useAccuratePricing && this.pricingService) {
77
+ try {
78
+ return await this.pricingService.getEC2Price(instanceType);
79
+ }
80
+ catch (error) {
81
+ // Fallback to estimate if API fails
82
+ }
83
+ }
84
+ return exports.EC2_PRICING[instanceType] || 50; // Generic estimate if type unknown
85
+ }
86
+ async getEBSMonthlyCost(sizeGB, volumeType) {
87
+ let pricePerGB;
88
+ if (this.useAccuratePricing && this.pricingService) {
89
+ try {
90
+ pricePerGB = await this.pricingService.getEBSPrice(volumeType);
91
+ }
92
+ catch (error) {
93
+ pricePerGB = exports.EBS_PRICING[volumeType] || 0.08;
94
+ }
95
+ }
96
+ else {
97
+ pricePerGB = exports.EBS_PRICING[volumeType] || 0.08;
98
+ }
99
+ return sizeGB * pricePerGB;
100
+ }
101
+ async getRDSMonthlyCost(instanceClass, engine) {
102
+ if (this.useAccuratePricing && this.pricingService && engine) {
103
+ try {
104
+ return await this.pricingService.getRDSPrice(instanceClass, engine);
105
+ }
106
+ catch (error) {
107
+ // Fallback to estimate
108
+ }
109
+ }
110
+ return exports.RDS_PRICING[instanceClass] || 100;
111
+ }
112
+ getS3MonthlyCost(sizeGB, storageClass = 'standard') {
113
+ const pricePerGB = exports.S3_PRICING[storageClass] || exports.S3_PRICING.standard;
114
+ return sizeGB * pricePerGB;
115
+ }
116
+ getELBMonthlyCost(type = 'alb') {
117
+ return exports.ELB_PRICING[type];
118
+ }
119
+ getEIPMonthlyCost() {
120
+ return exports.EIP_PRICING_HOURLY * 730; // ~$3.65
121
+ }
122
+ }
123
+ exports.CostEstimator = CostEstimator;
124
+ // Legacy exports for backwards compatibility
67
125
  function getEC2MonthlyCost(instanceType) {
68
- return exports.EC2_PRICING[instanceType] || 0;
126
+ return exports.EC2_PRICING[instanceType] || 50;
69
127
  }
70
128
  function getEBSMonthlyCost(sizeGB, volumeType) {
71
129
  const pricePerGB = exports.EBS_PRICING[volumeType] || 0.08;
72
130
  return sizeGB * pricePerGB;
73
131
  }
74
132
  function getRDSMonthlyCost(instanceClass) {
75
- return exports.RDS_PRICING[instanceClass] || 0;
133
+ return exports.RDS_PRICING[instanceClass] || 100;
76
134
  }
77
135
  function getS3MonthlyCost(sizeGB, storageClass = 'standard') {
78
136
  const pricePerGB = exports.S3_PRICING[storageClass] || exports.S3_PRICING.standard;
@@ -82,5 +140,5 @@ function getELBMonthlyCost(type = 'alb') {
82
140
  return exports.ELB_PRICING[type];
83
141
  }
84
142
  function getEIPMonthlyCost() {
85
- return exports.EIP_PRICING_HOURLY * 730; // ~$3.65
143
+ return exports.EIP_PRICING_HOURLY * 730;
86
144
  }
@@ -0,0 +1,38 @@
1
+ export declare class PricingService {
2
+ private pricingClient;
3
+ private region;
4
+ constructor(region?: string);
5
+ /**
6
+ * Get EC2 instance on-demand pricing for the configured region
7
+ */
8
+ getEC2Price(instanceType: string): Promise<number>;
9
+ /**
10
+ * Get EBS volume pricing per GB
11
+ */
12
+ getEBSPrice(volumeType: string): Promise<number>;
13
+ /**
14
+ * Get RDS instance pricing
15
+ */
16
+ getRDSPrice(instanceClass: string, engine?: string): Promise<number>;
17
+ /**
18
+ * Extract price from AWS Pricing API response
19
+ */
20
+ private extractPriceFromResponse;
21
+ /**
22
+ * Convert AWS region code to location name used in Pricing API
23
+ */
24
+ private getLocationName;
25
+ /**
26
+ * Normalize RDS engine name for Pricing API
27
+ */
28
+ private normalizeEngine;
29
+ /**
30
+ * Fallback estimates when API calls fail (based on us-east-1)
31
+ */
32
+ private getFallbackEC2Price;
33
+ private getFallbackEBSPrice;
34
+ private getFallbackRDSPrice;
35
+ }
36
+ export declare function getS3MonthlyCost(sizeGB: number, storageClass?: string): number;
37
+ export declare function getELBMonthlyCost(type?: 'alb' | 'nlb' | 'clb'): number;
38
+ export declare function getEIPMonthlyCost(): number;