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
- 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.1.1.tar.gz.
File metadata
- Download URL: cloudcosting-1.1.1.tar.gz
- Upload date:
- Size: 54.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7833af5e276d9d0171d04dc5c41dafdb73ff73bea6e022314e753d8671b482a
|
|
| MD5 |
d037c8f2e5f20a6340651e79500c29f6
|
|
| BLAKE2b-256 |
c80a143ec85d79536ca777e0a7e7d5c0e9d8a911a3ab23ea161909027fc8bf84
|
Provenance
The following attestation bundles were made for cloudcosting-1.1.1.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.1.1.tar.gz -
Subject digest:
b7833af5e276d9d0171d04dc5c41dafdb73ff73bea6e022314e753d8671b482a - Sigstore transparency entry: 1113280753
- Sigstore integration time:
-
Permalink:
dawsonlp/cloudcosting@3ec33f2a22d36497c3d208afe865c638f3301e5c -
Branch / Tag:
refs/tags/v1.1.1 - Owner: https://github.com/dawsonlp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_to_pypi.yaml@3ec33f2a22d36497c3d208afe865c638f3301e5c -
Trigger Event:
push
-
Statement type:
File details
Details for the file cloudcosting-1.1.1-py3-none-any.whl.
File metadata
- Download URL: cloudcosting-1.1.1-py3-none-any.whl
- Upload date:
- Size: 35.9 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 |
a9468e7d79ece179e2f7937c4fbfb58aac76cc44bf28a50c90d79f0ea234822f
|
|
| MD5 |
b5bab14e16551f2634b547d2874bdd39
|
|
| BLAKE2b-256 |
b680870302fc1dda489d7abf89defce4df7dc20ca58f473dbd608a6f9fd733a4
|
Provenance
The following attestation bundles were made for cloudcosting-1.1.1-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.1.1-py3-none-any.whl -
Subject digest:
a9468e7d79ece179e2f7937c4fbfb58aac76cc44bf28a50c90d79f0ea234822f - Sigstore transparency entry: 1113280765
- Sigstore integration time:
-
Permalink:
dawsonlp/cloudcosting@3ec33f2a22d36497c3d208afe865c638f3301e5c -
Branch / Tag:
refs/tags/v1.1.1 - Owner: https://github.com/dawsonlp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_to_pypi.yaml@3ec33f2a22d36497c3d208afe865c638f3301e5c -
Trigger Event:
push
-
Statement type: