The API provides public prices for the virtual machine service available from AWS, Azure and GCP. The database of prices is automatically updated monthly via a scheduled job.
The API supports a deployment using Helm Chart to deploy into a Kubernetes cluster.
Installing the chart will automatically create 2 pods:
- Cloud Info API
- PostgresSQL
Prerequisites
- Kubernetes Cluster 1.12+
- Helm
- PV provisioner support in the underlying infrastructure
Dependencies
- postgresql (10.12.7)
Instruction
Run the command below
helm install cloud-pricing ./cloud-pricing
It will deploy into your current namespaces two pods, it should look like this
NAME READY STATUS RESTARTS AGE
cloud-pricing-6b5cf4db97-bh4t5 1/1 Running 0 5d6h
cloud-pricing-postgresql-0 1/1 Running 0 5d6h
Once the API has been deployed and marked Running, you can access the API via port localhost:5042
GET /download
Download latest VMs prices from all providers. The prices will be stored in json file and ready to be digested and dumped into the database
GET /load
Parse pricing files, map relevant information and write it to the database
POST /query
Get the pricing information
Parameters expected:
- filter
- purchase_option
The parameter purchase_option
can accept either these options:
- OnDemand
- Reserved
- Spot
Example for parameter filter
for querying price for EC2 instance from AWS
{ "vendorName" : "aws", "productFamily": "Compute Instance" , "attributeFilters": [{"key": "instanceType", "value": "r5d.16xlarge"}, {"key": "tenancy", "value": "Shared"}, {"key": "operatingSystem", "value": "Linux"}]}
Example for the response
[
{
"memory": 512,
"price": 0.012,
"cpu": 64
},
]
We are glad to receive issues and pull requests from you, please kindy read our contributing guide for more information.
This project is heavily inspired by the project Cloud Pricing API developed by the folks @infracost
. Big thanks to them.