Skip to main content

@webframp/aws/cost-estimate

v2026.04.22.1

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)

Repository

https://github.com/webframp/swamp-extensions

Labels

awscostpricingfinopsestimatecloud

Contents

Quality score

How well-documented and verifiable this extension is.

100%

Grade A

  • 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

Install

$ swamp extension pull @webframp/aws/cost-estimate

@webframp/aws/cost-estimatev2026.03.30.4aws/cost_estimate.ts
estimate_ec2Estimate EC2 costs from inventory data
ArgumentTypeDescription
instanceIdstring
instanceTypestring
availabilityZonestring
platform?string
tags?record
estimate_rdsEstimate RDS costs from inventory data
ArgumentTypeDescription
dbInstanceIdstring
dbInstanceClassstring
enginestring
availabilityZone?string
multiAzboolean
allocatedStoragenumber
estimate_from_specEstimate costs for planned infrastructure (pre-deployment)
ArgumentTypeDescription
namestringInstance identifier/name
instanceTypestringEC2 instance type
regionstring
countnumberNumber of instances
namestringDB instance identifier
dbInstanceClassstringRDS instance class
enginestringDatabase engine
regionstring
multiAzboolean
storageGbnumber

Resources

estimate(1d)— Cost estimate for AWS resources