GithubHelp home page GithubHelp logo

iampatgrady / google-cloud-pricing-cost-calculator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cyclenerd/google-cloud-pricing-cost-calculator

0.0 1.0 0.0 875 KB

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

License: Apache License 2.0

Perl 88.24% Shell 11.76%

google-cloud-pricing-cost-calculator's Introduction

Google Cloud Platform Pricing and Cost Calculator

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
  • Calculation is done via gcosts Linux command line (CLI) program
  • Calculated costs are saved in CSV files

Full control and no disclosure of any information and costs to third parties. Everything tested and matched against the actual invoice in large Google Cloud migration projects.

Screenshot: YAML usage file, gcosts and CSV costs 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
      • Cost-optimized (E2, F1, G1)
      • Balanced (N1, N2, N2D)
      • Scale-out optimized (Tau T2D)
      • Memory-optimized (M1, M2)
      • Compute optimized (C2, C2D)
      • Accelerator optimized (A2)
    • Sustained use discounts (SUD) are applied to monthly costs
    • 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
      • RHEL for SAP
      • Windows Server
    • Custom machine types are supported (have to be created manually)
    • Spot and sole-tenant VMs are not supported
  • πŸ’Ύ Compute Engine Disks
    • All persistent disk (PD) types are supported
      • Zonal persistent disk
      • Regional persistent disk
      • Local SSD
  • πŸͺ£ Cloud Storage
    • All storage classes and location types are supported
      • region
      • dual-region
      • multi-region
  • πŸš‡ Cloud VPN
  • πŸ”— Cloud NAT
  • 🀹 Cloud Load Balancing
  • 🚦 Cloud Monitoring (Operations Suite)
    • Monitoring data
  • πŸ•ΈοΈ Network

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

  • BigQuery
  • Cloud SQL

πŸ§‘β€πŸ« 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 executable gcosts Linux CLI program.

Linux (x86_64) / Cloud Shell:

curl -OL "https://bit.ly/gcosts" && \
chmod +x gcosts && \
./gcosts --help

2. Download price information

Download the latest and tested price information file pricing.yml.

Linux / Cloud Shell:

curl -L "https://bit.ly/pricing_yml" \
     -o "pricing.yml"

3. Run it

Create your first YAML usage file (usage.yml):

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

Run the CLI program:

./gcosts

All YAML usage files (*.yml) of the current directory are imported and the costs of the resources are calculated:

Two CSV (semicolon) files with the costs are created:

  1. COSTS.csv : Costs for resources
  2. TOTALS.csv : Total costs per name, resource, project, region and file

You can import the CSV files with MS Excel, LibreOffice or Google Sheets.

4. Get familiar

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

πŸ€“ Pro Tip

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

Alias (~/.bash_aliases):

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

πŸ§‘β€πŸ’» Development

If you want to modify the Perl scripts or prefer to run the uncomplicated Perl scripts (gcosts.pl, skus.pl, mapping.pl, pricing.pl) and create the price information yourself, the following requirements are needed.

Perl 5 is already installed on many Linux (Debian/Ubuntu, RedHat, SUSE) and UNIX (macOS, FreeBSD) operating systems. For MS Windows you can download and install Strawberry Perl.

Requirements

Debian/Ubuntu:

sudo apt update
sudo apt install \
	libapp-options-perl \
	libwww-perl \
	libjson-xs-perl \
	libyaml-libyaml-perl \
	libdbd-csv-perl

Or install Perl modules with cpanminus:

cpan App::cpanminus
cpanm --installdeps .

Packager

Create the standalone executables gcosts CLI program.

Requirement:

sudo apt install libpar-packer-perl

Pack gcosts.pl into executable gcosts (or gcosts.exe on Win32):

pp -vvv -l libyaml-0.so.2 -o gcosts gcosts.pl

❀️ 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.

Please note:

  • No warranty
  • No official Google product

google-cloud-pricing-cost-calculator's People

Contributors

cyclenerd avatar github-actions[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.