Skip to main content

Cost estimation tool for IONOS Cloud infrastructure defined in Terraform

Project description

IONOS FinOps

License: MIT Python 3.8+

IONOS FinOps is an open-source cost estimation tool for IONOS Cloud infrastructure defined in Terraform. Similar to Infracost but specifically designed for IONOS, it provides 100% accurate pricing calculations for your infrastructure before deployment.

Features

  • ๐ŸŽฏ Accurate Pricing: Calculate exact costs based on IONOS's current pricing
  • ๐Ÿ“Š Terraform Integration: Parse Terraform files and state to extract IONOS resources
  • ๐Ÿ’ฐ Cost Breakdown: Detailed cost analysis per resource and resource type
  • ๐Ÿ”„ Diff Support: Compare costs between Terraform plans
  • ๐Ÿ“ˆ Multiple Output Formats: JSON, Table, HTML reports
  • ๐ŸŒ Multi-Region Support: Pricing for all IONOS data center locations
  • ๐Ÿ”Œ CI/CD Integration: Easy integration into your deployment pipelines

Supported IONOS Resources

  • Compute: Servers (VMs), Cubes, VCPUs, RAM
  • Storage: Block Storage, Object Storage (S3)
  • Networking: Load Balancers, IP Addresses, Network Bandwidth
  • Databases: DBaaS (PostgreSQL, MongoDB, MySQL, MariaDB)
  • Kubernetes: Managed Kubernetes clusters, node pools
  • Backup: Backup Units

Installation

From PyPI (when published)

pip install ionos-finops

From Source

git clone https://github.com/yourusername/ionos-finops.git
cd ionos-finops
pip install -e .

Quick Start

Basic Usage

# Calculate costs from Terraform directory
ionos-finops breakdown --path /path/to/terraform

# Calculate costs from Terraform plan
terraform plan -out=plan.tfplan
ionos-finops breakdown --plan-file plan.tfplan

# Output as JSON
ionos-finops breakdown --path . --format json

# Compare costs between current and planned state
ionos-finops diff --path .

Example Output

Project: my-ionos-infrastructure
Region: de/fra

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
โ”ƒ Resource                                    Monthly Cost    Yearly Cost      โ”ƒ
โ”กโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
โ”‚ ionos_server.web_server                    โ‚ฌ45.00          โ‚ฌ540.00          โ”‚
โ”‚   - 2 vCPUs                                 โ‚ฌ20.00          โ‚ฌ240.00          โ”‚
โ”‚   - 4 GB RAM                                โ‚ฌ15.00          โ‚ฌ180.00          โ”‚
โ”‚   - 50 GB Storage                           โ‚ฌ10.00          โ‚ฌ120.00          โ”‚
โ”‚                                                                               โ”‚
โ”‚ ionos_volume.data_volume                   โ‚ฌ30.00          โ‚ฌ360.00          โ”‚
โ”‚   - 200 GB SSD Storage                      โ‚ฌ30.00          โ‚ฌ360.00          โ”‚
โ”‚                                                                               โ”‚
โ”‚ ionos_loadbalancer.main_lb                 โ‚ฌ25.00          โ‚ฌ300.00          โ”‚
โ”‚                                                                               โ”‚
โ”‚ ionos_ipblock.public_ips                   โ‚ฌ5.00           โ‚ฌ60.00           โ”‚
โ”‚   - 2 IPv4 addresses                        โ‚ฌ5.00           โ‚ฌ60.00           โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ TOTAL                                       โ‚ฌ105.00         โ‚ฌ1,260.00        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Configuration

Create a .ionos-finops.yml file in your project root:

# IONOS API credentials (optional, for real-time pricing updates)
api_url: https://api.ionos.com/cloudapi/v6
api_token: ${IONOS_TOKEN}

# Default region
default_region: de/fra

# Currency
currency: EUR

# Pricing update frequency (in hours)
pricing_cache_ttl: 24

# Custom pricing overrides (optional)
custom_pricing:
  ionos_server:
    vcpu_hourly: 0.01
    ram_gb_hourly: 0.005

CI/CD Integration

GitHub Actions

name: IONOS Cost Estimation

on: [pull_request]

jobs:
  cost-estimate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      
      - name: Setup Terraform
        uses: hashicorp/setup-terraform@v2
      
      - name: Install IONOS FinOps
        run: pip install ionos-finops
      
      - name: Terraform Plan
        run: terraform plan -out=plan.tfplan
      
      - name: Calculate Costs
        run: ionos-finops breakdown --plan-file plan.tfplan --format json > costs.json
      
      - name: Comment PR
        uses: actions/github-script@v6
        with:
          script: |
            const fs = require('fs');
            const costs = JSON.parse(fs.readFileSync('costs.json', 'utf8'));
            // Add comment logic here

GitLab CI

ionos-cost-estimate:
  stage: plan
  script:
    - pip install ionos-finops
    - terraform plan -out=plan.tfplan
    - ionos-finops breakdown --plan-file plan.tfplan
  only:
    - merge_requests

Development

Setup Development Environment

# Clone the repository
git clone https://github.com/yourusername/ionos-finops.git
cd ionos-finops

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run linting
black .
flake8 .
mypy .

Project Structure

ionos-finops/
โ”œโ”€โ”€ ionos_finops/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ cli.py                 # CLI interface
โ”‚   โ”œโ”€โ”€ parser/
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ terraform.py       # Terraform file parser
โ”‚   โ”‚   โ””โ”€โ”€ hcl.py            # HCL parsing utilities
โ”‚   โ”œโ”€โ”€ pricing/
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ data.py           # Pricing data structures
โ”‚   โ”‚   โ”œโ”€โ”€ api.py            # IONOS API integration
โ”‚   โ”‚   โ””โ”€โ”€ calculator.py     # Cost calculation engine
โ”‚   โ”œโ”€โ”€ resources/
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ base.py           # Base resource class
โ”‚   โ”‚   โ”œโ”€โ”€ compute.py        # Compute resources
โ”‚   โ”‚   โ”œโ”€โ”€ storage.py        # Storage resources
โ”‚   โ”‚   โ”œโ”€โ”€ network.py        # Network resources
โ”‚   โ”‚   โ””โ”€โ”€ database.py       # Database resources
โ”‚   โ””โ”€โ”€ output/
โ”‚       โ”œโ”€โ”€ __init__.py
โ”‚       โ”œโ”€โ”€ table.py          # Table formatter
โ”‚       โ”œโ”€โ”€ json.py           # JSON formatter
โ”‚       โ””โ”€โ”€ html.py           # HTML report generator
โ”œโ”€โ”€ tests/
โ”œโ”€โ”€ examples/
โ”œโ”€โ”€ pricing_data/             # Static pricing data
โ”œโ”€โ”€ setup.py
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ README.md
โ””โ”€โ”€ LICENSE

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for details.

How to Contribute

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Pricing Data

Pricing data is maintained manually based on IONOS website pricing, with comprehensive validation and community contribution processes.

โš ๏ธ Important: IONOS API Limitations

IONOS does not provide a public pricing API. Their APIs focus on account-specific billing data rather than public pricing catalogs.

๐Ÿ“Š Current Pricing Data

Region Location Currency Status Source
de/fra Frankfurt EUR โœ… Current Manual
de/ber Berlin EUR โœ… Current Manual
de/fra2 Frankfurt 2 EUR โœ… Current Manual
gb/lhr London GBP โœ… Current Manual
gb/wor Worchester GBP โœ… Current Manual
fr/par Paris EUR โœ… Current Manual
es/log Logroรฑo EUR โœ… Current Manual
us/las Las Vegas USD โœ… Current Manual
us/ewr Newark USD โœ… Current Manual
us/kc Lenexa USD โœ… Current Manual

๐Ÿ› ๏ธ Manual Update Process

# Validate current pricing data
make validate-pricing

# Manual update workflow
# 1. Check IONOS website pricing
# 2. Update pricing files manually
# 3. Validate changes
make validate-pricing

# Test with sample infrastructure
ionos-finops breakdown --path examples/

๐Ÿค Community Contributions

Help keep pricing current! If you notice pricing changes on the IONOS website:

  1. Check Current Pricing: Visit IONOS Pricing Calculator
  2. Update Files: Edit relevant pricing files in ionos_finops/pricing_data/
  3. Validate: Run make validate-pricing
  4. Test: Verify with sample Terraform files
  5. Submit PR: Create pull request with pricing changes

๐Ÿ” Pricing Validation

The tool includes comprehensive pricing validation:

# Validate all pricing data
make validate-pricing

# Check pricing API status
python scripts/check_pricing_status.py

# Run pricing validation tests
pytest tests/test_pricing_validation.py -v

๐Ÿ“– Documentation

See docs/pricing-updates.md for detailed pricing update procedures and limitations.

Roadmap

  • Support for all IONOS Terraform resources
  • Real-time pricing API integration
  • Cost optimization recommendations
  • Budget alerts and thresholds
  • Historical cost tracking
  • Multi-cloud comparison (IONOS vs AWS/Azure/GCP)
  • Terraform Cloud/Enterprise integration
  • Web UI for cost visualization

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Support

Related Projects

This project supports and complements larger infrastructure cost management initiatives. If you're using Infracost for multi-cloud environments, IONOS FinOps provides the same level of accuracy specifically for IONOS Cloud resources.


Made with โค๏ธ for the IONOS Cloud community

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

ionos_finops-0.1.0.tar.gz (52.9 kB view details)

Uploaded Source

Built Distribution

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

ionos_finops-0.1.0-py3-none-any.whl (41.0 kB view details)

Uploaded Python 3

File details

Details for the file ionos_finops-0.1.0.tar.gz.

File metadata

  • Download URL: ionos_finops-0.1.0.tar.gz
  • Upload date:
  • Size: 52.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for ionos_finops-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2eb79885661ab39f990c537fb816645780946f33c27eee9161a7a1895a6e9b03
MD5 45a116ff25009ee875c05c381666ae4c
BLAKE2b-256 8dcfc5996380f1050f75d77b048a62f73f5432597f98685c773e1fd7eefae26b

See more details on using hashes here.

File details

Details for the file ionos_finops-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ionos_finops-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 41.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for ionos_finops-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5158532ba9dbb8829f2442a781d78d612dc613d535cb695c5260102507a4851c
MD5 d8e258052e1110c2c884402d45fa8e67
BLAKE2b-256 96e6b9ad9667f37a5c7eb7af38eaea011c91300d8bdb09255720246e309c25c4

See more details on using hashes here.

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