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.
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
)
- Cost-optimized (
- 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
- All machine types are supported
- ๐พ Compute Engine Disks
- All persistent disk (PD) types are supported
- Zonal persistent disk
- Regional persistent disk
- Local SSD
- All persistent disk (PD) types are supported
- ๐ชฃ Cloud Storage
- All storage classes and location types are supported
- region
- dual-region
- multi-region
- All storage classes and location types are supported
- ๐ 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
This guide is available as an interactive Cloud Shell tutorial. To get started, please click the following button:
Download the executable gcosts
Linux CLI program.
Linux (x86_64) / Cloud Shell:
curl -OL "https://bit.ly/gcosts" && \
chmod +x gcosts && \
./gcosts --help
Download the latest and tested price information file pricing.yml
.
Linux / Cloud Shell:
curl -L "https://bit.ly/pricing_yml" \
-o "pricing.yml"
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:
COSTS.csv
: Costs for resourcesTOTALS.csv
: Total costs per name, resource, project, region and file
You can import the CSV files with MS Excel, LibreOffice or Google Sheets.
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'
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.
- Perl 5 (
perl
) - Perl modules:
- App::Options
- LWP::UserAgent
- JSON::XS
- YAML::XS (and
libyaml
) - DBD::CSV
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 .
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
Have a patch that will benefit this project? Awesome! Follow these steps to have it accepted.
- Please read how to contribute.
- Fork this Git repository and make your changes.
- Create a Pull Request.
- Incorporate review feedback to your changes.
- Accepted!
All files in this repository are under the Apache License, Version 2.0 unless noted otherwise.
Please note:
- No warranty
- No official Google product