Skip to main content

Multi-cloud infrastructure cost estimation tool

Project description

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.

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
CLI cli.py Command-line interface

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

Setup

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

Usage

# Run estimation
python -m cloudcosting estimate config.yaml

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

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

# Cache management
python -m cloudcosting cache status
python -m cloudcosting cache refresh aws

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
python -m pytest tests/ -v

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

# Run with coverage
python -m pytest tests/ -v --tb=short

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

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cloudcosting-1.1.0.tar.gz (54.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cloudcosting-1.1.0-py3-none-any.whl (35.6 kB view details)

Uploaded Python 3

File details

Details for the file cloudcosting-1.1.0.tar.gz.

File metadata

  • Download URL: cloudcosting-1.1.0.tar.gz
  • Upload date:
  • Size: 54.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cloudcosting-1.1.0.tar.gz
Algorithm Hash digest
SHA256 06a37f6e06e879fa8e7953dd805fb5f3a57a6987adb1efa851ca73b1a80fe5da
MD5 0fc090c90aaad7ce802467347a8baab7
BLAKE2b-256 d8227f928fdc857d2e47d9ae0e85c5f95d03b660b3a3a3234a4fcea247685217

See more details on using hashes here.

Provenance

The following attestation bundles were made for cloudcosting-1.1.0.tar.gz:

Publisher: publish_to_pypi.yaml on dawsonlp/cloudcosting

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cloudcosting-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: cloudcosting-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 35.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cloudcosting-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d63b78d30909b590b7fc4cf7bf5d549813fb6d14c050d2d745528a3302e46a93
MD5 86ba505b9ce6f1740ceb177a07b36f51
BLAKE2b-256 3acf543e5f28c5fcb542ec86e7fded749678d98e3696b949043d0d90c515234b

See more details on using hashes here.

Provenance

The following attestation bundles were made for cloudcosting-1.1.0-py3-none-any.whl:

Publisher: publish_to_pypi.yaml on dawsonlp/cloudcosting

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page