Grid Intensity Go

A tool written in go to help you factor carbon intensity into decisions about where and when to run computing jobs.

GoDoc go-unit-test docker kubernetes nomad


A tool written in Go, designed to be integrated into Kubernetes, Nomad, and other schedulers, to help you factor carbon intensity into decisions about where and when to run jobs.

The tool has 3 components.

  • The grid-intensity CLI for interacting with carbon intensity data.
  • A Prometheus exporter with carbon intensity metrics that can be deployed via Docker, Nomad, or Kubernetes.
  • A Go library that can be integrated into your Go code.




We know that the internet runs on electricity. That electricity comes from a mix of energy sources, including wind and solar, nuclear power, biomass, fossil gas, oil and coal and so on,

We call this the fuel mix, and this fuel mix can impact on the carbon intensity of your code.

Move your code through time and space

Because the fuel mix will be different depending when and where you run your code, you can influence the carbon intensity of the code you write by moving it through time and space - either by making it run when the grid is greener, or making it run where it's greener, like a CDN running on green power.

Inspired By

This tool builds on research and tools developed from across the sustainable software community.





brew install thegreenwebfoundation/carbon-aware-tools/grid-intensity
  • Install via curl (feel free to do due diligence and check the script first).
curl -fsSL | sudo sh 
  • Fetch a binary release from the releases page.

grid-intensity CLI

The CLI allows you to interact with carbon intensity data from multiple providers.

$ grid-intensity
Provider needs an ISO country code as a location parameter.
ESP detected from your locale.
		"emissions_type": "average",
		"metric_type": "absolute",
		"provider": "Ember",
		"location": "ESP",
		"units": "gCO2e per kWh",
		"valid_from": "2021-01-01T00:00:00Z",
		"valid_to": "2021-12-31T23:59:00Z",
		"value": 193.737

The --provider and --location flags allow you to select other providers and locations. You can also set the GRID_INTENSITY_PROVIDER and GRID_INTENSITY_LOCATION environment variables or edit the config file at ~/.config/grid-intensity/config.yaml.

$ grid-intensity --provider CarbonIntensityOrgUK --location UK
	"from": "2022-07-14T14:30Z",
	"to": "2022-07-14T15:00Z",
	"intensity": {
		"forecast": 184,
		"actual": 194,
		"index": "moderate"

The providers section shows how to configure other providers.

grid-intensity exporter

The exporter subcommand starts the prometheus exporter on port 8000.

$ grid-intensity exporter --provider Ember --location FR
Using provider "Ember" with location "FR"
Metrics available at :8000/metrics

View the metrics with curl.

$ curl -s http://localhost:8000/metrics | grep grid
# HELP grid_intensity_carbon_average Average carbon intensity for the electricity grid in this location.
# TYPE grid_intensity_carbon_average gauge
grid_intensity_carbon_average{provider="Ember",location="FR",units="gCO2 per kWh"} 67.781

Docker Image

Build the docker image to deploy the exporter.

CGO_ENABLED=0 GOOS=linux go build -o grid-intensity .
docker build -t thegreenwebfoundation/grid-intensity:latest .


Install the helm chart in /helm/grid-intensity-exporter. Needs the Docker image to be available in the cluster.

helm install --set gridIntensity.location=FR grid-intensity-exporter helm/grid-intensity-exporter


Edit the Nomad job in /nomad/grid-intensity-exporter.nomad to set the env vars GRID_INTENSITY_LOCATION and GRID_INTENSITY_PROVIDER

Start the Nomad job. Needs the Docker image to be available in the cluster.

nomad run ./nomad/grid-intensity-exporter.nomad

grid-intensity-go library

See the /examples/ directory for examples of how to integrate each provider.


Currently these providers of carbon intensity data are integrated. If you would like us to integrate more providers please open an issue.

Electricity Maps

Electricity Map have carbon intensity data from multiple sources. You need to get an API token and URL from their API portal to use the API. You can use their free tier for non-commercial use or sign up for a 30 day trial.

The location parameter needs to be set to a zone present in the public zones endpoint.

grid-intensity --provider=ElectricityMap --location=IN-KA


WattTime have carbon intensity data from multiple sources. You need to register to use the API.

The location parameter should be set to a supported location. The /ba-from-loc endpoint allows you to provide a latitude and longitude. See the docs for more details.

WATT_TIME_USER=your-user \
WATT_TIME_PASSWORD=your-password \
grid-intensity --provider=WattTime --location=CAISO_NORTH


Carbon intensity data from Ember, is embedded in the binary in accordance with their licensing - CC-BY-SA 4.0

grid-intensity --provider=Ember --location=DE

The location parameter should be set to a 2 or 3 char ISO country code.

UK Carbon Intensity API

UK Carbon Intensity API this is a public API and the only location supported is UK.

grid-intensity --provider=CarbonIntensityOrgUK --location=UK

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.