Vantage is a cloud cost transparency platform. This is the official Python client for the Vantage API. You can use the API to get EC2 instance price and product information through a few simple-to-use API calls. The data offered through this API is heavily inspired from data avaiable from ec2instances.info. The feedback we get from users is that this API is significantly easier than learning and using AWS Pricing APIs. We have plans to expand the data available through this API in the future.
Feel free to join us in our community Slack in the #api channel. We're happy to chat and help. You're also welcome to email [email protected] or ping @JoinVantage on Twitter and we're happy to give assistance. Lastly, we monitor issues on this repo if you have any feature requests or issues.
The easiest way to get going is to install the client through PIP:
pip install vantage-client
Then import the package:
import vantage
The Vantage API is provided completely for free but requires an API token to use. To generate a free API token, follow these steps:
- Head to http://vantage.sh/
- Register a free account and confirm your email
- When you're asked "What would you like to do first?" click "Access Cloud Pricing API"
- Create an API token from the account profile page and you're all set
You'll only need to do this once and you can use your API token for all usage going forward.
This Python package is automatically generated by the Swagger Codegen project:
Python 2.7 and 3.4+
Please follow the installation procedure and then run the following:
from __future__ import print_function
import time
import vantage
from vantage.rest import ApiException
from pprint import pprint
# Configure OAuth2 access token for authorization: oauth2
configuration = vantage.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = vantage.CostsApi(vantage.ApiClient(configuration))
report_id = 'report_id_example' # str |
start_date = 'start_date_example' # str | Query costs by the first date you would like to filter from. ISO 8601 Formatted - 2021-07-15 or 2021-07-15T19:20:48+00:00. (optional)
end_date = 'end_date_example' # str | Query costs by the last date you would like to filter to. ISO 8601 Formatted - 2021-07-15 or 2021-07-15T19:20:48+00:00. (optional)
page = 2 # int | The page of results to return. (optional)
limit = 500 # int | The amount of results to return. The maximum is 1000 (optional)
try:
api_response = api_instance.get_costs(report_id, start_date=start_date, end_date=end_date, page=page, limit=limit)
pprint(api_response)
except ApiException as e:
print("Exception when calling CostsApi->get_costs: %s\n" % e)
All URIs are relative to https://api.vantage.sh
Class | Method | HTTP request | Description |
---|---|---|---|
CostsApi | get_costs | GET /v1/reports/{report_id}/costs | |
CostsApi | get_report | GET /v1/reports/{report_id} | |
CostsApi | get_reports | GET /v1/reports | |
PingApi | ping | GET /v1/ping | |
PricesApi | get_price | GET /v1/products/{product_id}/prices/{id} | |
PricesApi | get_prices | GET /v1/products/{product_id}/prices | |
PricesApi | get_product | GET /v1/products/{id} | |
PricesApi | get_products | GET /v1/products | |
PricesApi | get_providers | GET /v1/providers | |
PricesApi | get_services | GET /v1/services |
- Type: OAuth
- Flow: application
- Authorization URL:
- Scopes:
- read: Grants read access