npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@google-cloud/invoice-insights

v1.1.0

Published

A cloud invoice analyzer. Process your cloud invoice and transform into equivalent products in Google Cloud.

Downloads

10

Readme

Invoice Insights

This command line tool will analyze the invoice from a cloud provider and create a report with the total usage and cost, including the equivalent products and cost on GCP. We take the invoice CSV as input, and generate an ascii table or a CSV file with the information extracted.

This tool requires nodejs.

DISCLAIMER: This is not an officially supported Google product.

Processing the invoice

Only the AWS invoice is supported at this time. Invoice Insights can process the following services from the invoice:

  • AWS Regions and VM types.
  • Premium OS: Windows, Red Hat and Suse
  • Block Storage: sc1, st1, gp2 and io1
  • RDS Instance Hours
  • Elasticache Instance Hours

Translating into Google Cloud

Invoice Insights can translate to the following services on Google Cloud:

  • VM types: standard VMs (incl. high memory and high CPU), memory-optimized, custom (incl. extended memory), shared core (f1-micro and g1-small).
  • Usage type: on demand, preemptible, commit 1 year, commit 3 year
  • Premium OS: Windows, Red Hat and Suse
  • Block storage: Standard and SSD
  • Cloud SQL instances
  • Memorystore instances

Feature Roadmap

The following is a list of to-do features in the roadmap:

  • Local SSDs and GPUs are included in the report, but not automatically mapped to GCP yet.
  • RDS Storage, Aurora Storage and RDS Snapshots. You can extract those from the Summary.
  • Network egress report. You can extract that from the Summary.
  • S3 storage report (operations and Gb/month). You can extract that from the Summary.
  • SAP Premium OS (Red Hat and Suse)
  • SQL Server instances
  • Elasticache snapshots

Getting started

# Get high-level summary from an AWS invoice
npx @google-cloud/invoice-insights summary invoice.csv

# Get VM stats and GCP equivalent
npx @google-cloud/invoice-insights instances invoice.csv --format csv

# Print mappings with debug information, rounding to months, overriding a region mapping
npx @google-cloud/invoice-insights instances invoice.csv --debug --roundMonths --mapRegion eu-central-1=europe-west1

Mapping to instances on GCP

We search for a VM with the same number of CPUs and a difference in memory below the predefined memory window (10% by default). If there is no match, a custom VM will be used instead.

Shared core (t2 instances on AWS) will be mapped to f1-micro and g1-small on GCP when possible, or to a standard VM otherwise. Instance mappings can be overriden with --mapInstance, and region mapping with --mapRegion. These arguments can receive multiple values.

npx @google-cloud/invoice-insights invoice.csv --mapInstance t2.nano=n1-standard1 --mapInstance t2.micro=n1-standard2 --mapRegion eu-central-1=europe-west1

When calculating SUDs, we assume that VMs are running 730 hours per month (100% of the time) where possible. This is used to estimate the number of concurrent instances.

Exporting your invoice from AWS

If pricing details are considered sensitive information, filter out these columns when creating the invoice export from AWS:

  • BlendedRate
  • CurrencyCode
  • CostBeforeTax
  • Credits
  • TaxAmount
  • TaxType
  • TotalCost

Contributing

Pull Requests are welcome! If you are planning to work on this code, this is what you need to get started.

First, install the Google Cloud SDK and jq (sudo apt install jq). Once done, you may want to update the local information about pricing and VM types.

# Download the latest SKUs and VM sizes
bin/get-aws-skus
bin/get-gcp-skus
bin/get-gcp-vm-types

# Test that the downloaded files are well-formed JSON
npx jsonlint third_party/ec2instances.info/aws-skus.json
npx jsonlint assets/gcp-skus.json
npx jsonlint assets/gcp-vm-types.json

# Run the tests: (add --watch to keep watching)
npx mocha -r esm

To explore the SKUs manually:

# Find all SKUs for RAM and memory on Google Cloud
grep 'Ram running in' assets/gcp-skus.json | sort | uniq -u
grep 'Core running in' assets/gcp-skus.json | sort | uniq -u

# Find all SKUs for commitment 1yr
cat assets/gcp-skus.json | jq '.[] | select(.category.usageType=="Commit1Yr") | .description' | sort | uniq -u

# Find all Cloud SQL SKUs
cat assets/gcp-skus.json | jq '.[] | select(.category.serviceDisplayName=="Cloud SQL" and (.description | contains("Network") | not ) ) | .description' | sort | uniq -u

# Find all SKUs with more than one pricing tier (for example f1-micro is free the first 730 hours)
cat assets/gcp-skus.json | jq '.[] | select(.pricingInfo[].pricingExpression.tieredRates | length > 1) | .description'|sort |uniq -u