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

@tgwf/green-cost-explorer

v0.0.1

Published

How much of your AWS bill is spent on fossil fuels? This helps you find out.

Downloads

6

Readme

Green Cost Explorer - climate related spend analysis for AWS

All Contributors

If you work in technology, it's reasonable to think that you have some respect for science.

And if you have some respect for science, then you'll understand why spending a significant chunk of your monthly AWS bills on fossil fuel powered infrastructure isn't a thing we can afford to do anymore.

Because Amazon provide a helpful breakdown of which regions you use run on what they refer to as sustainable power, and which ones do not, and because they provide a cost-explorer tool, you combine this information to get an idea of where you might be spending money on fossil fuels without realising.

You can also just look at this nice cartoon. The ones which are notionally sustainable, have the green leaf next to them:

aws-geek-sustainable-regions

What this does

TODO:

  • [x] Sort your monthly spend into green vs grey spend
  • [x] Create a basic table showing this
  • [ ] Show this as a chart
  • [ ] Project forward, using AWS's cost projection features, to help you see these against your own commmitments

Usage

This is a wrapper around the AWS NodeJS SDK, so by default, it looks for creds in your environment the way the AWS NodeJS normally does. However, you can also set following the environment variables to override these to try it out.

AWS_ACCESS_KEY_ID='YOUR_KEY_ID'
AWS_SECRET_ACCESS_KEY='YOUR_SECRET_ACCESS_KEY'

Once you have this, call greencost to get an idea of your spend over the last year.

It looks for the AWS credentials in your environment, but if you're not comfortable with this, the AWS SDK lets you pass in credentials in number of ways.

npx greencost

If all goes well, you'll get something like this (sample data below):

┌──────────────────────────────┬──────────────────────────────┐
│ Total Green Cost             │ Total Grey Cost              │
├──────────────────────────────┼──────────────────────────────┤
│ 49.0% ($146.66)              │ 51.0% ($152.48)              │
└──────────────────────────────┴──────────────────────────────┘
┌──────────────────────────────┬──────────────────────────────┬──────────────────────────────┐
│ month                        │ Green Cost by month          │ Grey Cost by month           │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│ 2018-08-01                   │ 64.8% ($11.55)               │ 35.2% ($6.27)                │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│ 2018-09-01                   │ 27.5% ($13.42)               │ 72.5% ($35.47)               │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│ 2018-10-01                   │ 66.6% ($13.60)               │ 33.4% ($6.82)                │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│ 2018-11-01                   │ 68.0% ($13.59)               │ 32.0% ($6.39)                │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│ 2018-12-01                   │ 34.0% ($11.62)               │ 66.0% ($22.54)               │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│ 2019-01-01                   │ 52.0% ($19.43)               │ 48.0% ($17.94)               │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│ 2019-02-01                   │ 49.4% ($19.64)               │ 50.6% ($20.13)               │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│ 2019-03-01                   │ 52.0% ($21.61)               │ 48.0% ($19.92)               │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│ 2019-04-01                   │ 56.6% ($22.19)               │ 43.4% ($16.99)               │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘

There are also flags to let you see a breakdown by service as well.

Note: Only infrastructure costs are taken into consideration. Non-infrastructure global costs like Taxes are ignored.

Licensing

Feel free to use this commercially - part of your job as a professional in tech is to avoid unnecessary harm, and burning fossil fuels to run our infrastructure:

  • objectively causes harm
  • is avoidable, by either switching regions, or using a different provider, or contacting AWS about offsetting the emissions from running infra in their non-sustainable regions.

To be honest, given this is all about tracking your own spend, so it's actually pretty hard to make this something you couldn't use for commercial use.

So, Apache 2.0, yo.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!