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 |
| Formatters | formatters.py |
Output format transformations (docsmith) |
| 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 |
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
# 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
# Cache management
cloudcosting cache status
cloudcosting cache refresh aws
All commands can also be run via python -m cloudcosting instead of the cloudcosting script (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 |
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/providers/aws/test_rds.py -v
# Run with coverage
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
- Create a calculator module in
providers/aws/calculators/withvalidate()andestimate()functions - Register it in
providers/aws/provider.pyCALCULATOR_REGISTRY - Add tests in
tests/unit/providers/aws/
Adding New Providers
- Create a provider package under
providers/(e.g.,providers/azure/) - Implement the same interface as
AwsProvider(withestimate_resources()) - 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cloudcosting-1.2.0.tar.gz.
File metadata
- Download URL: cloudcosting-1.2.0.tar.gz
- Upload date:
- Size: 56.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a88dbed37d5aef77212460cdbb7a44f168d1a279371d0e5c93903385f4efdc3
|
|
| MD5 |
743973be82cae8f7e315ed544577b4a2
|
|
| BLAKE2b-256 |
6e55e3935f20b6fbaf45a31150cc991599dd2b4633367a9985f67342b336d59a
|
Provenance
The following attestation bundles were made for cloudcosting-1.2.0.tar.gz:
Publisher:
publish_to_pypi.yaml on dawsonlp/cloudcosting
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cloudcosting-1.2.0.tar.gz -
Subject digest:
3a88dbed37d5aef77212460cdbb7a44f168d1a279371d0e5c93903385f4efdc3 - Sigstore transparency entry: 1113648666
- Sigstore integration time:
-
Permalink:
dawsonlp/cloudcosting@e6675244cc5d0c04cb78369fd7c5c9462230aabe -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/dawsonlp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_to_pypi.yaml@e6675244cc5d0c04cb78369fd7c5c9462230aabe -
Trigger Event:
push
-
Statement type:
File details
Details for the file cloudcosting-1.2.0-py3-none-any.whl.
File metadata
- Download URL: cloudcosting-1.2.0-py3-none-any.whl
- Upload date:
- Size: 37.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf1277187a8521f1db492a5d610334ac94bfeaa43ae1786117a92de31aa55dfd
|
|
| MD5 |
caf3ad5cd76c59c4ea1879fbb3988151
|
|
| BLAKE2b-256 |
286bd0bd8af54ad71366f6bad84d5bbb25052511f87c74bb9b3abdb8a0f09ac5
|
Provenance
The following attestation bundles were made for cloudcosting-1.2.0-py3-none-any.whl:
Publisher:
publish_to_pypi.yaml on dawsonlp/cloudcosting
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cloudcosting-1.2.0-py3-none-any.whl -
Subject digest:
bf1277187a8521f1db492a5d610334ac94bfeaa43ae1786117a92de31aa55dfd - Sigstore transparency entry: 1113648678
- Sigstore integration time:
-
Permalink:
dawsonlp/cloudcosting@e6675244cc5d0c04cb78369fd7c5c9462230aabe -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/dawsonlp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_to_pypi.yaml@e6675244cc5d0c04cb78369fd7c5c9462230aabe -
Trigger Event:
push
-
Statement type: