Crates.io | osc-cost |
lib.rs | osc-cost |
version | 0.5.3 |
source | src |
created_at | 2023-02-09 09:20:31.436836 |
updated_at | 2024-02-16 09:54:29.718659 |
description | osc-cost helps measuring Outscale infrastructure costs |
homepage | |
repository | https://github.com/outscale/osc-cost |
max_upload_size | |
id | 780610 |
size | 318,784 |
osc-cost allows Outscale users to estimate their cloud costs.
This program only provides a cost estimation of the current account state. Only official bills provided by Outscale will represent your consumption. Read license for more details.
--skip-resource Oos
to disable this computation.)Current cost per hour
Current cost per month
Current cost per year
Json (line-delimited JSON document)
Human
Open Document Spreadsheet (Ods)
Prometheus
Go to release and download latest binary.
You will need .osc/config.json
file in you home folder. osc-cost takes default
profile if not specified.
Example of config.json
:
{
"default": {
"access_key": "YoUrAcCeSsKeY",
"secret_key": "YoUrSeCrEtKeY",
"region": "eu-west-2"
}
}
Here are few examples with different output formats. Note that json
format will provide the most detailed output.
osc-cost --format=human # default
Summary:
โญโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโฎ
โ Account Id โ 620346218618 โ
โโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโค
โ Total price per hour โ 2.2062643โฌ โ
โโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโค
โ Total price per month โ 1610.5729โฌ โ
โโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโค
โ Total price per year โ 19326.875โฌ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโฏ
Details:
โญโโโโโโโโโโโโโโโโฌโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโฎ
โ Resource Type โ Count โ Total price per hour โ Total price per month โ Total price per year โ
โโโโโโโโโโโโโโโโโชโโโโโโโโชโโโโโโโโโโโโโโโโโโโโโโโชโโโโโโโโโโโโโโโโโโโโโโโโชโโโโโโโโโโโโโโโโโโโโโโโก
โ Snapshot โ 23 โ 0.03164384โฌ โ 23.1โฌ โ 277.2โฌ โ
โโโโโโโโโโโโโโโโโผโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโค
โ Vm โ 9 โ 1.7939999โฌ โ 1309.6199โฌ โ 15715.438โฌ โ
โโโโโโโโโโโโโโโโโผโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโค
โ LoadBalancer โ 2 โ 0.06โฌ โ 43.8โฌ โ 525.6โฌ โ
โโโโโโโโโโโโโโโโโผโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโค
โ NatServices โ 2 โ 0.1โฌ โ 73โฌ โ 876โฌ โ
โโโโโโโโโโโโโโโโโผโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโค
โ Volume โ 12 โ 0.20554796โฌ โ 150.04999โฌ โ 1800.5999โฌ โ
โโโโโโโโโโโโโโโโโผโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโค
โ PublicIp โ 7 โ 0.015โฌ โ 10.95โฌ โ 131.4โฌ โ
โโโโโโโโโโโโโโโโโผโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโค
โ Oos โ 5 โ 0.00007237231โฌ โ 0.05283179โฌ โ 0.63398147โฌ โ
โฐโโโโโโโโโโโโโโโโดโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโฏ
osc-cost --format=hour
0.42
osc-cost --format=month
150.91
osc-cost --format=json
{"resource_type":"Vm","osc_cost_version":"0.1.0","account_id":"509075394552","read_date_rfc3339":"2022-11-24T11:15:50.665643413+00:00","region":"eu-west-2","resource_id":"i-e51434a6","price_per_hour":0.044,"price_per_month":32.12,"vm_type":"tinav4.c1r1p2","vm_vcpu_gen":"4","vm_core_performance":"high","vm_image":"ami-bb490c7e","vm_vcpu":1,"vm_ram_gb":1,"price_vcpu_per_hour":0.039,"price_ram_gb_per_hour":0.005,"price_box_per_hour":0.0,"price_product_per_ram_gb_per_hour":0.0,"price_product_per_cpu_per_hour":0.0,"price_product_per_vm_per_hour":0.0}
{"resource_type":"Volume","osc_cost_version":"0.1.0","account_id":"509075394552","read_date_rfc3339":"2022-11-24T11:15:50.665643413+00:00","region":"eu-west-2","resource_id":"vol-9e99bad9","price_per_hour":0.02321918,"price_per_month":16.95,"volume_type":"io1","volume_size":15,"volume_iops":1500,"price_gb_per_month":0.13,"price_iops_per_month":0.01}
{"resource_type":"PublicIp","osc_cost_version":"0.1.0","account_id":"509075394552","read_date_rfc3339":"2022-11-24T11:15:50.665643413+00:00","region":"eu-west-2","resource_id":"eipalloc-2e5f8e4f","price_per_hour":0.0,"price_per_month":0.0,"price_non_attached":null,"price_first_ip":0.0,"price_next_ips":null}
...
NOTE: The next feature is still in beta
The tools can also be used to see the drift between osc-cost estimation and what have been actually recorded. Here are the steps to do that:
osc-cost --format json --output account.json
osc-cost --compute-drift --from-date "$(date "+%Y-%m-%d" --date='-1day') --to-date $(date "+%Y-%m-%d") --input account.json
In order to have default values in prometheus format please use:
osc-cost -n --format=prometheus
You will have the details of the drift.
โญโโโโโโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโฌโโโโโโโโฎ
โ Resource Type โ Osc-cost โ Digest โ Drift โ
โโโโโโโโโโโโโโโโโชโโโโโโโโโโโชโโโโโโโโโชโโโโโโโโก
โ Volume โ 1.18 โ 1.18 โ 0% โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโผโโโโโโโโค
โ Oos โ 0.01 โ 0.01 โ -5% โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโผโโโโโโโโค
โ Snapshot โ 1.25 โ 0.62 โ 101% โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโผโโโโโโโโค
โ Vm โ 34.01 โ 34.01 โ 0% โ
โฐโโโโโโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโดโโโโโโโโฏ
Check contributing documentation.
Update chart version (if necessary) in helm/osccost/Chart.yaml
and osc-cost version in helm/osccost/values.yaml
Tag the release
git tag -a vX.X.X -m "vX.X.X"
But what is prometheus (Prometheus)
We create a prometheus exporter (Prometheus-Exporter)
To have something simple to manipulate we create a serde for prometheus. (Serde)
You can deploy with helm chart (osc-cost)
You can also deploy with docker-compose (docker-compose)
You need to have a config file.
Test with an account with several cloud object.
For prometheus, you can use docker-compose file in the projet to test with prometheus.
Or you can test with k8s cluster.
To test with k8s cluster, you can use kind but for me i create a cluster with one worker and one master using this project (osc-k8s-rke-cluster)
A account on outscale on eu-west-2/cloud-gouv or us-east-2. If you want on another region, please create omi on those region.
Copyright Outscale SAS
BSD-3-Clause
This project is compliant with REUSE.