Skip to main content

cloudcosting

Multi-cloud infrastructure cost estimation tool. Fetches real-time pricing from cloud provider APIs (AWS Pricing API), caches results locally, and produces structured YAML/JSON cost breakdowns. Includes a comparison command for side-by-side multi-scenario cost analysis with docsmith-compatible output for Word document generation.

Architecture

Config YAML -> Config Loader -> Estimator -> Provider Registry -> AWS Provider
                                                                    |
                                                              Calculator per resource type
                                                                    |
                                                              Pricing Adapter (API + Cache)
                                                                    |
                                                              Estimate output (YAML/JSON)

Layers

Layer Module Responsibility
Domain domain.py Dataclasses, exceptions, serialization
Config config.py YAML parsing, structural validation
Cache cache.py File-based pricing cache with TTL
Estimator estimator.py Transaction script: config -> providers -> aggregate
Provider providers/aws/ AWS-specific pricing adapter and calculators
Formatters formatters.py Output format transformations (docsmith)
Composer composer.py Multi-scenario comparison document composition
CLI cli.py Command-line interface (estimate, cache, compare)

Supported AWS Resource Types

Type Calculator Required Params
rds RDS instances engine, instance_class, storage_gb
ec2 EC2 instances instance_type
nat_gateway NAT Gateways (none required)
alb Application Load Balancers (none required)
ebs EBS Volumes size_gb
s3 S3 Storage size_gb

Installation

pipx install cloudcosting

This makes the cloudcosting command available globally.

Development Setup

For contributing or local development:

cd cloudcosting
uv venv .venv
source .venv/bin/activate
uv pip install -e ".[dev]"

Usage

Estimating Costs

# Run estimation (YAML output)
cloudcosting estimate config.yaml

# Output as JSON
cloudcosting estimate config.yaml --format json

# Output as docsmith-compatible YAML (for Word document generation)
cloudcosting estimate config.yaml --format docsmith -o estimate.yaml

# Pipe directly to docsmith for Word document
cloudcosting estimate config.yaml --format docsmith | docsmith -

# Write to file
cloudcosting estimate config.yaml -o costs.yaml

# Use a specific AWS credentials profile
cloudcosting estimate config.yaml --profile production

Comparing Scenarios

Compare costs across multiple infrastructure configurations. Produces a docsmith-compatible YAML document with side-by-side cost tables.

# Compare two configurations
cloudcosting compare Small:small.yaml Large:large.yaml

# With custom document title and line-item detail
cloudcosting compare Small:small.yaml Large:large.yaml \
  --title "Project Phoenix" --detail

# Write comparison to file, then generate Word document
cloudcosting compare Small:small.yaml Large:large.yaml -o comparison.yaml
docsmith comparison.yaml

# Bare paths (scenario names derived from filenames)
cloudcosting compare small.yaml large.yaml

# Multiple scenarios with a shared AWS profile
cloudcosting compare Small:s.yaml Medium:m.yaml Large:l.yaml --profile production

Scenario specs use the format Name:path or just path. When the name is omitted, the filename stem is used (e.g., small.yaml becomes scenario name small).

Tip: Label your resources in config files for meaningful comparisons. Resources are aligned across scenarios by their label field. Without labels, resources get auto-generated names like EC2 t3.micro which may not match as expected across different configurations.

Cache Management

cloudcosting cache status
cloudcosting cache refresh aws
cloudcosting cache refresh

All commands can also be run via python -m cloudcosting (e.g., python -m cloudcosting estimate config.yaml).

Output Formats

Format Flag Description
yaml --format yaml (default) Structured estimate with full metadata
json --format json Same structure as YAML, serialized as JSON
docsmith --format docsmith docsmith-compatible YAML for Word document generation

The compare command always produces docsmith-compatible YAML output.

Example Config

provider: aws
region: us-east-1

resources:
  - type: rds
    label: Primary Database
    engine: postgres
    instance_class: db.r6g.xlarge
    storage_gb: 250
    multi_az: true

  - type: ec2
    label: Web Servers
    instance_type: t3.micro
    count: 3

  - type: nat_gateway
    label: NAT Gateways
    count: 2

  - type: alb
    label: Application Load Balancer

  - type: ebs
    label: Data Volumes
    size_gb: 500
    volume_type: gp3
    count: 3

  - type: s3
    label: Document Storage
    size_gb: 1000

Testing

# Run all tests
pytest tests/ -v

# Run specific test module
pytest tests/unit/test_domain.py -v
pytest tests/unit/test_composer.py -v
pytest tests/unit/providers/aws/test_rds.py -v

79 unit tests covering domain invariants, config validation, cache behavior, calculator arithmetic, full estimation pipeline, and comparison composition.

Adding New Resource Types

  1. Create a calculator module in providers/aws/calculators/ with validate() and estimate() functions
  2. Register it in providers/aws/provider.py CALCULATOR_REGISTRY
  3. Add tests in tests/unit/providers/aws/

Adding New Providers

  1. Create a provider package under providers/ (e.g., providers/azure/)
  2. Implement the same interface as AwsProvider (with estimate_resources())
  3. Register it in providers/registry.py

Metadata

Release files for cloudcosting 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cloudcosting 1.3.0
File Size Uploaded
cloudcosting-1.3.0.tar.gz 76.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cloudcosting 1.3.0
File Interpreter ABI Platform
cloudcosting-1.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 117.6 kB

Release files / cloudcosting-1.3.0.tar.gz

Download URL cloudcosting-1.3.0.tar.gz
Size 76.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d7bc9278aced893cb833064bb82741ab48339b14b54b042f5d65548b6778a54e
BLAKE2b-256 checksum
How to use checksums
7823c93bedbdd338f50776747b954b37e70a496f049518ba6edd23f0792d316f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 17, 2026.

Transparency log

Release files / cloudcosting-1.3.0-py3-none-any.whl

Download URL cloudcosting-1.3.0-py3-none-any.whl
Size 41.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2632043a714b07601e67482f413d1e8d2a5df5fe7c9fc2ad797fc266981cab6
BLAKE2b-256 checksum
How to use checksums
45332f2e79a811b2955d76a8920b52ac3d9854b64ff88a8998441a0f0a765eb4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.3.0 This release

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page