osc-cost 0.5.4

osc-cost helps measuring OUTSCALE infrastructure costs
docs.rs failed to build osc-cost-0.5.4
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: osc-cost-0.5.3

osc-cost

Project Sandbox


🌐 Links


📄 Table of Contents


🧭 Overview

osc-cost is a command-line utility that estimates current cloud costs for an Outscale account by analyzing live resource states.

It supports multiple output formats and can also export metrics to Prometheus or compare estimated costs against digest-based billing (experimental).


🚧 Project Status

⚠️ This project is in sandbox status and under active development. Cost estimations are approximations and may differ from official billing. Only official invoices from OUTSCALE are authoritative.


✅ Requirements

  • An OUTSCALE account with access to the API
  • ~/.osc/config.json for credentials
  • Linux/macOS shell (tested with Bash)
  • Prometheus (optional, for metric export)

🔨 Installation

Download the latest binary from the GitHub Releases page.

Make it executable:

chmod +x osc-cost
mv osc-cost /usr/local/bin/

🛠 Configuration

The tool expects credentials in ~/.osc/config.json.

Example config:

{
  "default": {
    "access_key": "YOUR_ACCESS_KEY",
    "secret_key": "YOUR_SECRET_KEY",
    "region": "eu-west-2"
  }
}

To use a different profile, use the --profile flag.


🚀 Usage

Estimate costs (default format: human-readable)

osc-cost

Output options

osc-cost --format=human        # human-friendly output
osc-cost --format=json         # detailed structured output
osc-cost --format=ods          # ODS spreadsheet
osc-cost --format=prometheus   # Prometheus format
osc-cost --format=hour         # Only price per hour
osc-cost --format=month        # Only price per month

Skip expensive resources

osc-cost --skip-resource Oos

📊 Drift Analysis (Beta)

Compare cost estimations with actual usage from digest:

Step 1 – Export estimation

osc-cost --format=json --output account.json

Step 2 – Freeze the account for a day

Step 3 – Compare costs the next day

osc-cost --compute-drift \
  --from-date "$(date -d '-1 day' +%Y-%m-%d)" \
  --to-date "$(date +%Y-%m-%d)" \
  --input account.json

Example output

╭───────────────┬──────────┬────────┬───────╮
│ Resource Type ┆ Osc-cost ┆ Digest ┆ Drift │
╞═══════════════╪══════════╪════════╪═══════╡
│ Volume        ┆ 1.18     ┆ 1.18   ┆ 0%    │
│ Snapshot      ┆ 1.25     ┆ 0.62   ┆ 101%  │
╰───────────────┴──────────┴────────┴───────╯

📈 Prometheus Exporter

Export estimated prices in Prometheus format:

osc-cost --format=prometheus -n

A serde formatter is used to expose metrics in a simple text format.


🚢 Deployment

With Helm

Use the osc-cost Helm chart for Kubernetes deployment.

With Docker Compose

docker-compose -f helm/docker-compose.yaml up

On Kubernetes (Kind or RKE)

You can deploy with any Kubernetes setup.


🤝 Contributing

We welcome your contributions!

Please read the CONTRIBUTING.md guide.


🚀 Release Process

  1. Update Chart.yaml and values.yaml in helm/osccost/
  2. Tag a release:
git tag -a vX.X.X -m "vX.X.X"
  1. Push the tag and publish the release on GitHub.

📜 License

osc-cost is licensed under the BSD 3-Clause License. © Outscale SAS This project is compliant with the REUSE Specification