A python package for scraping and exporting GCP Compute Machines metadata and costs information.
Project description
GCP Compute Machines Costs
This project is a python package for scraping and exporting GCP Compute Machines metadata and costs information.
Requirements
- python >= 3.12
- GCP service account with the next assigned permissions:
- compute.machineTypes.list
- compute.regions.list
- compute.zones.list
Installation
pip install gcp-compute-machines
Usage
Create new file scrape.py with the next content and change gcp_project_name and gcp_sa_account_path variables.
API Scraper
from gcp_compute_machines import GCPMachinesScraper
gcp_project_name = 'CHANGE_ME'
gcp_sa_account_path = 'CHANGE_ME'
scraper = GCPMachinesScraper(
gpc_project_name=gcp_project_name,
gcp_sa_account_path=gcp_sa_account_path
)
machines = scraper.fetch_gcp_machines(
# dump=True means that app saves the scrapped SKUs data locally
dump=True,
# Set load=True if you want to use local SKUs data between sequential runs.
load=False
)
scraper.dump_pricing_info(
file_path='./data/flat_gcp_machines_pricing.yaml'
)
Loader for https://gcloud-compute.com/
This code downloads data from the website above and loads it into pydantic model.
from gcp_compute_machines import GCloudComputeMachinesProvider
scraper = GCloudComputeMachinesProvider()
machines = scraper.fetch_gcp_machines()
scraper.dump_pricing_info("./data/flat_gcloud_compute_machines_pricing.yaml")
Keep in mind that:
- All pricing fields are normalized to hourly cost
- Some fields were renamed or dropped
License
This project is under the Apache License, Version 2.0 unless noted otherwise.
Important info
Please note this project is not an official Google product.
That means no warranty in costs data integrity. Use scraped data wisely.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gcp_compute_machines-0.1.0.tar.gz.
File metadata
- Download URL: gcp_compute_machines-0.1.0.tar.gz
- Upload date:
- Size: 21.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a80402cdd064eafd4a509ea1e90c7489738f4c5eda9a36e0b3a0c44a924b676c
|
|
| MD5 |
3527df1ac6b642b68aeb311c0e1ea003
|
|
| BLAKE2b-256 |
867113cba34135388d0a84719e494020bd274a22769cf2a2460b472b1df48460
|
Provenance
The following attestation bundles were made for gcp_compute_machines-0.1.0.tar.gz:
Publisher:
publish.yml on vbutoma/gcp-compute-machines-costs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gcp_compute_machines-0.1.0.tar.gz -
Subject digest:
a80402cdd064eafd4a509ea1e90c7489738f4c5eda9a36e0b3a0c44a924b676c - Sigstore transparency entry: 214605493
- Sigstore integration time:
-
Permalink:
vbutoma/gcp-compute-machines-costs@3cd6bcbe4d51d721bbb675c2f9793459bef8454d -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/vbutoma
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3cd6bcbe4d51d721bbb675c2f9793459bef8454d -
Trigger Event:
release
-
Statement type:
File details
Details for the file gcp_compute_machines-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gcp_compute_machines-0.1.0-py3-none-any.whl
- Upload date:
- Size: 32.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ab80c7453b89b3adf842d17fbe799c08a921c4671f50698c4ac3600ef2cc553
|
|
| MD5 |
c4c8b191e2888e0c5de607e17ee409a4
|
|
| BLAKE2b-256 |
a52932ce6ab5285b6610a374abd568570250456ccb198acd7c4b30500670f9ae
|
Provenance
The following attestation bundles were made for gcp_compute_machines-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on vbutoma/gcp-compute-machines-costs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gcp_compute_machines-0.1.0-py3-none-any.whl -
Subject digest:
3ab80c7453b89b3adf842d17fbe799c08a921c4671f50698c4ac3600ef2cc553 - Sigstore transparency entry: 214605495
- Sigstore integration time:
-
Permalink:
vbutoma/gcp-compute-machines-costs@3cd6bcbe4d51d721bbb675c2f9793459bef8454d -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/vbutoma
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3cd6bcbe4d51d721bbb675c2f9793459bef8454d -
Trigger Event:
release
-
Statement type: