pg-spot-ops / pg-spot-operator

Maintains stateful Postgres on Spot VMs
Other
2 stars 0 forks source link

Cli price check mode #32

Closed kmoppel closed 3 days ago

kmoppel commented 4 days ago

Add a new CLI flag --check-price which resolves HW reqs, displays the current Spot price and exits.

Complementart to https://github.com/pg-spot-ops/pg-spot-operator/issues/10 which would still be great, to scan multiple regions and do some price averaging as current price is not the best indicator probably.

python3 -m pg_spot_operator  --region eu-north-1 --zone eu-north-1b  --cpu-min 4  --instance-name pg3 --storage-min 1000 --storage-type local  --check-price
2024-10-11 15:16:46,333 INFO Resolving HW requirements to actual instance types / prices ...
2024-10-11 15:16:48,538 INFO Cheapest instance type found: i3en.xlarge (x86)
2024-10-11 15:16:48,540 INFO Main specs - vCPU: 4, RAM: 32 GB, instance storage: 2500
2024-10-11 15:16:49,091 INFO Current Spot discount rate in AZ eu-north-1b: -70.5% (spot $100.6 vs on-demand $341.3)