• Stars
    star
    141
  • Rank 259,971 (Top 6 %)
  • Language
    Perl
  • License
    Apache License 2.0
  • Created almost 3 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸ’Έ Calculate estimated monthly costs of Google Cloud Platform products and resources via YAML files and CLI program (Linux, macOS, Windows)

Google Cloud Platform Pricing and Cost Calculator

Badge: Google Cloud Badge: Linux Badge: macOS Badge: Windows Badge: Go Go Report Card Badge: CI Badge: GitHub

πŸ† Awarded
This project was the winner of the Google Open Source Peer Bonus in 2022 πŸ₯³

Calculate estimated monthly costs of Google Cloud Platform products and resources. Optimized for DevOps, architects and engineers to quickly see a cost breakdown and compare different options upfront:

  • Mapping of resource usage is done in easy to learn YAML usage files
  • Price information is read from a local file (pricing.yml)
  • Calculation is done via gcosts CLI program
  • Calculated costs are saved in CSV file optimized for non-technical audience

Full control and no disclosure of any information and costs to third parties. Everything is calculated on your local computer. No need to have a connection to the Internet. Everything tested and matched against the actual invoice in large Google Cloud migration projects. Over 320 automated tests ensure gcosts reliability. gcosts works on various OS and terminals, including Windows CMD, macOS iTerm2, and in CI systems like GitHub Actions.

1️⃣ Create YAML file 2️⃣ Run gcosts CLI program 3️⃣ Open CSV file
Screenshot: YAML usage file Screenshot: gcosts CLI program Screenshot: CSV file

☁️ Supported resources

The cost of a resource is calculated by multiplying its price by its usage.

πŸ’‘ Google Cloud Free Program
Free tiers and free trial (90-day, $300), which are usually not a significant part of cloud costs, are ignored. For example: 1x free non-preemptible e2-micro VM instance per month, free NAT for 32 VMs, 30 GB-months standard persistent disk, 1 GB network egress and everything else are not taken into account.

Resources that gcosts supports, and Google charges for:

πŸ–₯️ Compute Engine Instances
  • All machine types are supported
    • A2 and G2 accelerator optimized machines
    • C2, C2D and H3 compute optimized machine series
    • M1, M2 and M3 memory optimized machine series
    • C3, E2, N1, N2, N2D, T2D and T2A general purpose machine series
  • Sustained use discounts (SUD) are applied to monthly costs
  • Spot provisioning model (Spot VM) is supported
  • Flexible committed use discounts (Flexible CUD) are not supported
  • 1 year and 3 year committed use discounts (CUD) are supported
  • Paid "premium" operating system licenses (paid images) are supported
    • SUSE Linux Enterprise Server
    • SLES for SAP (1y and 3y committed use discounts (CUD) are also supported)
    • Red Hat Enterprise Linux (1y and 3y committed use discounts (CUD) are also supported)
    • RHEL for SAP (1y and 3y committed use discounts (CUD) are also supported)
    • Windows Server
  • Custom machine types are supported (have to be created manually)
  • Sole-tenant VMs are not supported
πŸ’Ύ Compute Engine Disks
  • All persistent disk (PD) types are supported
    • Zonal persistent disk
    • Regional persistent disk
    • Local SSD
    • Provisioned IOPS
πŸͺ£ Cloud Storage
  • All storage classes and location types are supported
    • region
    • dual-region
    • multi-region
  • Retrieval fees are calulated
πŸš‡ Hybrid Connectivity
  • VPN tunnel
  • Interconnect is currently not calculated
πŸ”— Cloud NAT
  • NAT gateway
  • Data processing (both egress and ingress)
🚦 Cloud Monitoring (Operations Suite)
  • Monitoring data
πŸ•ΈοΈ Network
  • Premium Tier internet egress
    • Worldwide destinations (excluding China & Australia, but including Hong Kong)
    • China destinations (excluding Hong Kong)
    • Australia destinations
πŸ—οΈ TODO

The following services are not currently supported, but are on the TODO list:

  • BigQuery
  • Cloud SQL

Please suggest other resources worth covering by upvoting existing issue or opening new issue.

πŸ§‘β€πŸ« Start the interactive tutorial

This guide is available as an interactive Cloud Shell tutorial. To get started, please click the following button:

Open in Cloud Shell

πŸƒ Quick start

1. Get gcosts program

Download the ready complied and executable gcosts CLI program for your operating system and architecture.

Linux

Download:

  • x86_64 Intel or AMD 64-Bit CPU
    curl -L "https://github.com/Cyclenerd/google-cloud-pricing-cost-calculator/releases/latest/download/gcosts-linux-x86_64" \
         -o "gcosts" && \
    chmod +x "gcosts"
  • arm64 Arm-based 64-Bit CPU (i.e. in Raspberry Pi)
    curl -L "https://github.com/Cyclenerd/google-cloud-pricing-cost-calculator/releases/latest/download/gcosts-linux-arm64" \
         -o "gcosts" && \
    chmod +x "gcosts"

To determine your OS version, run getconf LONG_BIT or uname -m at the command line.

Execute gcosts:

./gcosts help
macOS

Download:

  • x86_64 Intel 64-bit
    curl -L "https://github.com/Cyclenerd/google-cloud-pricing-cost-calculator/releases/latest/download/gcosts-macos-x86_64" \
         -o "gcosts" && \
    chmod +x "gcosts"
  • arm64 Apple silicon 64-bit
    curl -L "https://github.com/Cyclenerd/google-cloud-pricing-cost-calculator/releases/latest/download/gcosts-macos-arm64" \
         -o "gcosts" && \
    chmod +x "gcosts"

To determine your OS version, run uname -m at the command line.

Execute gcosts:

./gcosts help
Windows

Download:

  • x86_64 Intel or AMD 64-Bit CPU
    Invoke-WebRequest -Uri "https://github.com/Cyclenerd/google-cloud-pricing-cost-calculator/releases/latest/download/gcosts-windows-x86_64.exe" -OutFile "gcosts.exe"
  • arm64 Arm-based 64-Bit CPU
    Invoke-WebRequest -Uri "https://github.com/Cyclenerd/google-cloud-pricing-cost-calculator/releases/latest/download/gcosts-windows-arm64.exe" -OutFile "gcosts.exe"

To determine your OS version, run echo %PROCESSOR_ARCHITECTURE% at the command line.

Execute gcosts.exe:

.\gcosts.exe help

2. Download price information

Download the latest and tested price information file pricing.yml. The price information is automatically regenerated on a weekly basis. Download the updated pricing file regularly.

Linux

Download pricing.yml:

curl -L "https://github.com/Cyclenerd/google-cloud-pricing-cost-calculator/raw/master/pricing.yml" \
     -o "pricing.yml"
macOS

Download pricing.yml:

curl -L "https://github.com/Cyclenerd/google-cloud-pricing-cost-calculator/raw/master/pricing.yml" \
     -o "pricing.yml"
Windows

Download pricing.yml:

Invoke-WebRequest -Uri "https://github.com/Cyclenerd/google-cloud-pricing-cost-calculator/raw/master/pricing.yml" -OutFile "pricing.yml"

3. Run it

Prepare a separate directory (i.e. usage) just for your YAML usage files and create your first YAML usage file (resources.yml) in this directory:

region: europe-west4
project: my-first-project
instances:
  - name: app-server
    type: e2-standard-8
    os: rhel
    commitment: 3
    disks:
      - name: disk-boot
        type: ssd
        data: 75

Warning If the price list (pricing.yml) is in the same directory, errors occur because the YAML file is also parsed.

Execute the CLI program:

Linux

Execute gcosts:

./gcosts calc --pricing YML-PRICING-PATH
macOS

Execute gcosts:

./gcosts calc --pricing YML-PRICING-PATH
Windows

Execute gcosts.exe:

.\gcosts.exe calc --pricing YML-PRICING-PATH

Without extra specification of the directory all YAML files (*.yml) of the current directory are imported and the costs of the resources are calculated. You can specify the directory:

gcosts calc --dir DIRECTORY-PATH --pricing YML-PRICING-PATH

The calculated costs are exported to one CSV (comma-separated values) file. Without specifying the file location, the file is named costs.csv and is saved in the current directory. You can specify the CSV export file:

gcosts calc --csv CSV-EXPORT-FILE-PATH --pricing YML-PRICING-PATH

You can import the CSV file with MS Excel, Apple Numbers, LibreOffice or Google Sheets.

4. Get familiar

Continue to familiarize yourself with the options. The following documentations are prepared for this purpose:

πŸ€“ Tip

Add gcosts to your Shell aliases with absolute pathnames. You can then execute gcosts anywhere.

Alias (~/.aliases):

alias gcosts='/your-pathname/gcosts --pricing /your-pathname/pricing.yml'

❀️ Contributing

Have a patch that will benefit this project? Awesome! Follow these steps to have it accepted.

  1. Please read how to contribute.
  2. Fork this Git repository and make your changes.
  3. Create a Pull Request.
  4. Incorporate review feedback to your changes.
  5. Accepted!

πŸ“œ License

All files in this repository are under the Apache License, Version 2.0 unless noted otherwise.

Portions of this repository are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 4.0 Attribution License.

More Repositories

1

ethereum_nvidia_miner

πŸ’° USB flash drive ISO image for Ethereum, Zcash and Monero mining with NVIDIA graphics cards and Ubuntu GNU/Linux (headless)
Shell
854
star
2

static_status

🚦Bash script to generate a static status page.
Shell
533
star
3

gallery_shell

πŸ“· Bash Script to generate static responsive image web galleries.
Shell
241
star
4

google-cloud-compute-machine-types

☁️ Choose the optimal Google Compute Engine machine type or instance in the many Google Cloud Platform regions
Perl
230
star
5

postinstall

πŸ’» Bash Script to automate post-installation steps
Shell
155
star
6

google-cloud-gcp-openai-api

🌴 Drop-in replacement REST API for Vertex AI (PaLM 2, Codey, Gemini) that is compatible with the OpenAI API specifications
Jupyter Notebook
86
star
7

benchmark

πŸ‹οΈ Bash Script which runs several Linux benchmarks (Sysbench, UnixBench and Geekbench)
Shell
55
star
8

poweroff-google-cloud-cap-billing

πŸ“΄ Automating cost control by capping Google Cloud billing
HCL
41
star
9

aws-pricing

πŸ’Έ Choose the optimal Amazon EC2 instance type in the many AWS locations
Perl
28
star
10

google-cloud-litellm-proxy

πŸš… LiteLLM Proxy for Google Cloud Generative AI
Dockerfile
27
star
11

Latrine

πŸ“‘ Locus Map GPS Live Tracking Server Script
HTML
14
star
12

google-cloud-server-on-demand

▢️ Server on Demand Appliance (Google Compute Engine) - Cloud Build with Terraform and Ansible Showcase
HCL
12
star
13

google-cloud-shell-vscode

β›… Run OpenVSCode Server in Google Cloud Shell
Shell
11
star
14

google-workload-identity-federation

πŸ” Google Cloud Workload Identity Federation Examples and How-To
11
star
15

scp-tools-gitlab

🦊 Docker Image with SAP Cloud Platform Tools (SAP Business Technology Platform) optimized for GitLab Runner and Google Cloud Build
Dockerfile
11
star
16

cloud-tools-container

πŸ“¦ Ready-to-use Docker container image with cloud tools (AWS CLI, Google Cloud CLI, Terraform, Packer, Ansible)
Dockerfile
9
star
17

sap-on-gcp-scripts

β˜• SAP on Google Cloud Platform Boilerplate
Shell
8
star
18

iot-maneki-neko

🐱 IoT Maneki-Neko (Beckoning Cat, Luck Cat, Winkekatze)
C++
8
star
19

toolbox

πŸ”§ Toolbox - Script Collection
Jupyter Notebook
7
star
20

macos-missing-shutdown-app

🍎 macOS Shutdown, Restart, Sleep and Log Out App
6
star
21

iot-weather-mqtt

☁️ WiFi Weather Sensor that talks MQTT (SAP IoT Cloud Ready)
C++
6
star
22

quarqd

πŸ’‘ quarqd is a daemon for communicating with an ANT+ device
C
5
star
23

obs-emoji

πŸ˜ƒ Emoji Live Reactions Animation for OBS (Open Broadcaster Software)
HTML
5
star
24

google-cloud-iam

☁️ Google Cloud Identity and Access Management (IAM)
Perl
4
star
25

dotfiles

⌨ My dotfiles and script to perform user-defined configurations
Shell
4
star
26

notify-me

πŸ“Ÿ CLI scripts to get notified via MS Teams, Discord, Pushover, sipgate SMS and many more...
Perl
4
star
27

terraform-google-wif-github

πŸ” Terraform module to create a Google Cloud Workload Identity Pool and Provider for GitHub Actions
HCL
3
star
28

terraform-google-quota-limits

πŸŒͺ️ Terraform module to update Google Cloud consumer quota limits
HCL
3
star
29

blocklocker

πŸ”— IoT Blockchain Locker
Perl
3
star
30

veloherodown

🚴 Create a local copy of your Velo Hero data
Shell
3
star
31

terraform-google-wif-gitlab

πŸ” Terraform module to create a Google Cloud Workload Identity Pool and Provider for GitLab CI
HCL
3
star
32

qmk-massdrop-ctrl

⌨️ My custom QMK Massdrop CTRL firmware
C
2
star
33

terraform-google-wif-service-account

πŸ” Terraform module to allow login via Google Cloud Workload Identity Pool and Provider for service accounts
HCL
2
star
34

google-cloud-appengine-mail-api

πŸ“§ Create your own Mail API based on Google App Engine (GAE)
Python
2
star
35

iot-consumption

☁️ SAPUI5 app for the built-in MMS OData API from the SAP Cloud IoT
JavaScript
2
star
36

google-cloud-gcp-pfsense

☁️ Connect your pfSense firewall to the Google Cloud Platform (GCP) via IPsec VPN (even with non-static IP address)
Shell
2
star
37

Cyclenerd

😎 My GitHub Profile README
1
star
38

google-cloud-unused-service-accounts

πŸ€– Detect unused Service Accounts in Google Cloud Platform
Shell
1
star
39

google-cloud-identity-platform

πŸ”‘ Google Cloud Identity Platform Examples and How-To (Sign in with GitHub, GitLab, Microsoft, Google)
HTML
1
star
40

SapMachineInstaller

SapMachine (SAP supported version of OpenJDK) Windows Installer
NSIS
1
star
41

veloheroup

🚴 Command line interface for uploading to Velo Hero
Shell
1
star