Skip to main content

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

gcp_compute_machines-0.1.1.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gcp_compute_machines-0.1.1-py3-none-any.whl (32.6 kB view details)

Uploaded Python 3

File details

Details for the file gcp_compute_machines-0.1.1.tar.gz.

File metadata

  • Download URL: gcp_compute_machines-0.1.1.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

Hashes for gcp_compute_machines-0.1.1.tar.gz
Algorithm Hash digest
SHA256 94ea08e388f020610f2b754ce9c592ff114308ae931f962eed4b6acaad25c31f
MD5 069214a23c8918daa0f6bf150aa0e200
BLAKE2b-256 2195865e62473419c7c68a47536000d9ccc0a7037b5e05e2bd96dd588e56a928

See more details on using hashes here.

Provenance

The following attestation bundles were made for gcp_compute_machines-0.1.1.tar.gz:

Publisher: publish.yml on vbutoma/gcp-compute-machines-costs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gcp_compute_machines-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for gcp_compute_machines-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 55ac496717b694ff486a852a7a875a8f73cd81136cd6fd6dcdd163f6a90d432d
MD5 d44b65419914dc2a70499f2a244d85a7
BLAKE2b-256 73e09cf6d0c7ed2881fce7736120d040c022025b1a40e0e536195ae85ed35939

See more details on using hashes here.

Provenance

The following attestation bundles were made for gcp_compute_machines-0.1.1-py3-none-any.whl:

Publisher: publish.yml on vbutoma/gcp-compute-machines-costs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page