01README
Calculate AWS infrastructure costs from inventory data or planned specs.
Authentication
Uses the default AWS credential chain. The Pricing API is public data but requires valid AWS credentials.
Usage
From Inventory (existing resources)
First gather inventory using @webframp/aws/inventory, then estimate costs:
# Create models
swamp model create @webframp/aws/inventory aws-inventory --global-arg region=us-east-1
swamp model create @webframp/aws/cost-estimate cost-est
# Gather inventory
swamp model method run aws-inventory list_ec2
# Get inventory data
EC2_DATA=$(swamp data get aws-inventory ec2-us-east-1 --json | jq '.data.resources')
# Estimate costs (pass inventory as JSON)
swamp model method run cost-est estimate_ec2 \
--input "inventory=${EC2_DATA}"From Spec (planned resources)
Estimate costs before deployment:
swamp model method run cost-est estimate_from_spec \
--input 'ec2Instances=[{"name":"web","instanceType":"t3.medium","count":3}]' \
--input 'rdsInstances=[{"name":"db","dbInstanceClass":"db.t3.medium","engine":"postgres","storageGb":100}]'Pricing Notes
- Uses AWS Pricing API for real-time rates
- Assumes On-Demand pricing (no Reserved Instances or Savings Plans)
- EC2: Includes compute only (no EBS, transfer)
- RDS: Includes compute + storage (gp2 rate default)
02Models
@webframp/aws/cost-estimatev2026.03.30.4aws/cost_estimate.ts
fn estimate_ec2(instanceId: string, instanceType: string, availabilityZone: string, platform?: string, tags?: record)
Estimate EC2 costs from inventory data
| Argument | Type | Description |
|---|---|---|
| instanceId | string | |
| instanceType | string | |
| availabilityZone | string | |
| platform? | string | |
| tags? | record |
fn estimate_rds(dbInstanceId: string, dbInstanceClass: string, engine: string, availabilityZone?: string, multiAz: boolean, allocatedStorage: number)
Estimate RDS costs from inventory data
| Argument | Type | Description |
|---|---|---|
| dbInstanceId | string | |
| dbInstanceClass | string | |
| engine | string | |
| availabilityZone? | string | |
| multiAz | boolean | |
| allocatedStorage | number |
fn estimate_from_spec(name: string, instanceType: string, region: string, count: number, name: string, dbInstanceClass: string, engine: string, region: string, multiAz: boolean, storageGb: number)
Estimate costs for planned infrastructure (pre-deployment)
| Argument | Type | Description |
|---|---|---|
| name | string | Instance identifier/name |
| instanceType | string | EC2 instance type |
| region | string | |
| count | number | Number of instances |
| name | string | DB instance identifier |
| dbInstanceClass | string | RDS instance class |
| engine | string | Database engine |
| region | string | |
| multiAz | boolean | |
| storageGb | number |
Resources
estimate(1d)— Cost estimate for AWS resources
03Previous Versions
2026.04.13.1Apr 13, 2026
2026.03.31.1Mar 31, 2026
2026.03.30.4Mar 31, 2026
2026.03.30.3Mar 30, 2026
2026.03.30.2Mar 30, 2026
2026.03.30.1Mar 30, 2026
04Stats
A
100 / 100
Downloads
5
Archive size
209.0 KB
- Has README or module doc2/2earned
- README has a code example1/1earned
- README is substantive1/1earned
- Most symbols documented1/1earned
- No slow types1/1earned
- Has description1/1earned
- At least one platform tag (or universal)1/1earned
- Two or more platform tags (or universal)1/1earned
- License declared1/1earned
- Verified public repository2/2earned
05Platforms
06Labels