cloud-cost-cli 0.1.1 → 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
@@ -5,7 +5,7 @@
5
5
 
6
6
  **Optimize your cloud spend in seconds.**
7
7
 
8
- 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.
9
9
 
10
10
  ---
11
11
 
@@ -18,157 +18,140 @@ Cloud bills are growing faster than revenue. Engineering teams overprovision, fo
18
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.
19
19
 
20
20
  **What it finds:**
21
- - Idle EC2/Compute instances (low CPU, stopped but still billed)
22
- - Unattached EBS volumes and snapshots
23
- - 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)
24
24
  - Old load balancers with no traffic
25
- - Unused Elastic IPs
26
- - Underutilized reserved instances or savings plan mismatches
27
- - Redundant S3 storage (lifecycle policies missing)
25
+ - Unused public IP addresses
26
+ - Underutilized resources that can be downsized
27
+ - Storage without lifecycle policies
28
28
 
29
29
  ---
30
30
 
31
- ## Features (MVP - Week 1–2)
32
-
33
- - ✅ AWS support (EC2, EBS, RDS, S3, ELB, Elastic IP)
34
- - ✅ Connect via AWS credentials (IAM read-only recommended)
35
- - ✅ Analyze last 30 days of usage
36
- - ✅ Output top 5 savings opportunities with estimated monthly savings
37
- - ✅ Export report as JSON, Markdown, or terminal table
38
- - ✅ Zero third-party API dependencies (uses AWS SDK directly)
39
-
40
- **Coming soon:**
41
- - GCP and Azure support
42
- - Slack/email alerts for new cost spikes
43
- - Scheduled reports (cron-friendly)
44
- - Team dashboard (web UI, SaaS)
45
- - Custom rules and thresholds
46
- - 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!
47
57
 
48
58
  ---
49
59
 
50
60
  ## Installation
51
61
 
52
62
  **Requirements:**
53
- - Node.js >= 18 (or use the standalone binary)
54
- - 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
55
67
 
56
68
  **Install via npm:**
57
69
  ```bash
58
70
  npm install -g cloud-cost-cli
59
71
  ```
60
72
 
61
- **Or download standalone binary:**
62
- ```bash
63
- # macOS/Linux
64
- 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
65
- chmod +x /usr/local/bin/cloud-cost-cli
73
+ ---
74
+
75
+ ## Usage
66
76
 
67
- # Windows (PowerShell)
68
- 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"
77
+ **AWS scan:**
78
+ ```bash
79
+ cloud-cost-cli scan --provider aws --profile default --region us-east-1
69
80
  ```
70
81
 
71
- ---
82
+ **Azure scan:**
83
+ ```bash
84
+ # Set Azure subscription ID (or use --subscription-id flag)
85
+ export AZURE_SUBSCRIPTION_ID="your-subscription-id"
72
86
 
73
- ## Usage
87
+ cloud-cost-cli scan --provider azure --location eastus
88
+ ```
74
89
 
75
- **Basic scan (AWS):**
90
+ **Show more opportunities:**
76
91
  ```bash
77
- cloud-cost-cli scan --provider aws --profile default
92
+ cloud-cost-cli scan --provider aws --top 20 # Show top 20 instead of default 5
78
93
  ```
79
94
 
80
- **Specify region and output format:**
95
+ **Filter by minimum savings:**
81
96
  ```bash
82
- 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
83
98
  ```
84
99
 
85
- **Top N opportunities:**
100
+ **Specify output format:**
86
101
  ```bash
87
- cloud-cost-cli scan --provider aws --top 10
102
+ cloud-cost-cli scan --provider aws --output json > report.json
88
103
  ```
89
104
 
90
105
  **Example output:**
91
106
  ```
92
107
  Cloud Cost Optimization Report
93
- Provider: AWS | Region: us-east-1 | Account: 123456789012
108
+ Provider: AWS | Region: us-east-1 | Account: N/A
94
109
  Analyzed: 2026-01-01 to 2026-01-31
95
110
 
96
111
  Top 5 Savings Opportunities (est. $1,245/month):
97
112
 
98
- 1. Idle EC2 instance: i-0abc123def456
99
- Type: m5.large | Running 720h | Avg CPU: 2%
100
- → Recommendation: Stop or downsize to t3.small
101
- Est. savings: $65/month
102
-
103
- 2. Unattached EBS volume: vol-0xyz789abc
104
- Size: 500 GB (gp3) | Age: 45 days
105
- Recommendation: Delete or snapshot + delete
106
- → Est. savings: $40/month
107
-
108
- 3. Oversized RDS instance: mydb-production
109
- Type: db.r5.xlarge | Avg connections: 5 | Avg CPU: 15%
110
- → Recommendation: Downsize to db.t3.large
111
- → 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
+ └───┴──────────┴────────────────────────────────────────┴──────────────────────────────────────────────────────────┴─────────────┘
112
126
 
113
- 4. Unused Elastic Load Balancer: my-old-alb
114
- Active targets: 0 | Requests/day: 0
115
- → Recommendation: Delete
116
- → Est. savings: $22/month
127
+ Total potential savings: $1,245/month ($14,940/year)
117
128
 
118
- 5. S3 bucket with no lifecycle policy: logs-bucket-2023
119
- Size: 12 TB | Age: 18 months
120
- → Recommendation: Enable Intelligent-Tiering or Glacier transition
121
- → Est. savings: $938/month
129
+ Summary: 47 resources analyzed | 12 idle | 8 oversized | 5 unused
122
130
 
123
- 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.
124
133
  ```
125
134
 
126
135
  ---
127
136
 
128
- ## Configuration
129
-
130
- Create a config file at `~/.cloud-cost-cli/config.json` (optional):
131
-
132
- ```json
133
- {
134
- "aws": {
135
- "profile": "default",
136
- "regions": ["us-east-1", "us-west-2"],
137
- "excludeResources": ["i-0abc123", "vol-xyz"],
138
- "thresholds": {
139
- "idleCpuPercent": 5,
140
- "minAgeDays": 7
141
- }
142
- },
143
- "output": {
144
- "format": "table",
145
- "includeRecommendations": true
146
- }
147
- }
148
- ```
137
+ ## Pricing Estimates
149
138
 
150
- ---
139
+ **How cost estimates work:**
151
140
 
152
- ## 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.
153
142
 
154
- **Phase 1 (Week 1–2): MVP**
155
- - AWS support (EC2, EBS, RDS, S3, ELB, EIP)
156
- - CLI with basic scan and reporting
157
- - GitHub Sponsors setup
158
- - 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
159
148
 
160
- **Phase 2 (Month 2):**
161
- - GCP support
162
- - Azure support
163
- - Scheduled reports (cron mode)
164
- - Slack webhook integration
165
- - 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
166
153
 
167
- **Phase 3 (Month 3+):**
168
- - SaaS version: connect account, weekly email reports, team dashboard
169
- - Paid tiers: $29/mo (alerts + history), $99/mo (multi-account + API)
170
- - Enterprise: on-prem, SSO, audit logs, custom rules
171
- - 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.
172
155
 
173
156
  ---
174
157
 
@@ -181,25 +164,33 @@ Contributions welcome! Please open an issue before submitting large PRs.
181
164
  git clone https://github.com/vuhp/cloud-cost-cli.git
182
165
  cd cloud-cost-cli
183
166
  npm install
184
- npm run dev
167
+ npm run build
185
168
  ```
186
169
 
187
170
  **Run tests:**
188
171
  ```bash
189
- 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
190
181
  ```
191
182
 
192
183
  ---
193
184
 
194
- ## Sponsorship
185
+ ## Support This Project
195
186
 
196
- 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).
197
188
 
198
- **Sponsor tiers:**
199
- - $5/mo: Thank you!
200
- - 🚀 $25/mo: Early access to new features + priority support
201
- - 💼 $100/mo: Logo on README + monthly 1:1 consultation (30 min)
202
- - 🏢 $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
203
194
 
204
195
  ---
205
196
 
@@ -211,27 +202,30 @@ MIT License - see [LICENSE](LICENSE)
211
202
 
212
203
  ## Credits
213
204
 
214
- **Powered by:**
215
- - AWS SDK for JavaScript
216
- - Commander.js
217
- - Chalk (terminal colors)
218
- - 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
219
211
 
220
212
  ---
221
213
 
222
214
  ## FAQ
223
215
 
224
216
  **Q: Does this tool make changes to my infrastructure?**
225
- 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.
226
218
 
227
- **Q: What IAM permissions are required?**
228
- 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
229
223
 
230
224
  **Q: How accurate are the savings estimates?**
231
- 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.).
232
226
 
233
227
  **Q: Can I run this in CI/CD?**
234
- 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.
235
229
 
236
230
  ---
237
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;