Use Google Compute Engine Api to calculate current cost

A nice thing with cloud providers who provide an Api is that you can come up with new features by yourself. You don’t need to wait for the next release anymore.

As soon as I tried Google Compute Engine, I wanted to know the daily/monthly cost of what I was doing. My question was simple:

“If I leave things as they are, right now, how much will it cost me this month?”

So I wrote some code, because, you know, it’s what I do 😉 Also it was a good excuse to try Atom‘s support for CoffeeScript. To be more precise, I tried Atom’s support for literate CoffeeScript but that’s a post for tomorrow!

Here’s the first version of my code. It doesn’t compute the whole cost. There’s still a lot to do. Also, I’m sure it contains bugs, so no warranty!

The code tells you what’s you daily and monthly burn rate.