{"id":13724102,"url":"https://github.com/carboniferio/carbonifer","last_synced_at":"2025-09-20T04:31:55.351Z","repository":{"id":65536792,"uuid":"588729837","full_name":"carboniferio/carbonifer","owner":"carboniferio","description":"Control carbon emission of your cloud infrastructure - Carbon-aware cloud infra","archived":false,"fork":false,"pushed_at":"2024-07-13T05:09:23.000Z","size":383,"stargazers_count":99,"open_issues_count":15,"forks_count":11,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-09-16T20:51:24.636Z","etag":null,"topics":["aws","azure","carbon-aware","carbon-emissions","carbon-footprint","carbonifer","cloud","data-centers","gcp","greenops","sustainability","terraform"],"latest_commit_sha":null,"homepage":"https://carbonifer.io/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/carboniferio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-13T21:07:20.000Z","updated_at":"2025-08-13T23:04:54.000Z","dependencies_parsed_at":"2024-07-19T23:00:38.240Z","dependency_job_id":"572ea4b7-3c55-4bde-9b3c-5e97cefd2c86","html_url":"https://github.com/carboniferio/carbonifer","commit_stats":{"total_commits":86,"total_committers":5,"mean_commits":17.2,"dds":"0.19767441860465118","last_synced_commit":"502052caeda060df06758f0d57769480bd998fd6"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/carboniferio/carbonifer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carboniferio%2Fcarbonifer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carboniferio%2Fcarbonifer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carboniferio%2Fcarbonifer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carboniferio%2Fcarbonifer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/carboniferio","download_url":"https://codeload.github.com/carboniferio/carbonifer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carboniferio%2Fcarbonifer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276004302,"owners_count":25568564,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-19T02:00:09.700Z","response_time":108,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","azure","carbon-aware","carbon-emissions","carbon-footprint","carbonifer","cloud","data-centers","gcp","greenops","sustainability","terraform"],"created_at":"2024-08-03T01:01:50.231Z","updated_at":"2025-09-20T04:31:55.325Z","avatar_url":"https://github.com/carboniferio.png","language":"Go","funding_links":[],"categories":["Green Software Awesome List","Go","Consumption"],"sub_categories":["Contents","Computation and Communication"],"readme":"[![Go](https://github.com/carboniferio/carbonifer/actions/workflows/go.yml/badge.svg?branch=main)](https://github.com/carboniferio/carbonifer/actions/workflows/go.yml) [![Go Reference](https://pkg.go.dev/badge/github.com/carboniferio/carbonifer.svg)](https://pkg.go.dev/github.com/carboniferio/carbonifer)\n\n\n![Carbonifer Logo](https://user-images.githubusercontent.com/2562534/215261762-f3efb0a2-813b-43d9-a08c-53cdc8825112.png)\n\nhttps://carbonifer.io/\n\nCommand Line Tool to control carbon emission of your cloud infrastructure.\nReading Terraform files, `carbonifer plan` will estimate future Carbon Emissions of infrastructure and help make the right choices to reduce Carbon footprint.\n\n## Scope\n\nThis tool currently estimates usage emissions, not embodied emissions (manufacturing, transport, recycling...). It is not a full LCA (Life Cycle Assessment) tool.\n\nThis tool can analyze Infrastructure as Code definitions such as:\n\n- [Terraform](https://www.terraform.io/) files\n- (more to come)\n\nIt can estimate Carbon Emissions of:\n\n- **Google Cloud Platform**\n  - [x] **Compute Engine**\n    - [x] Compute Instances (generic and custom machine types, and from template)\n    - [x] Disks (boot, persistent and region-persistent, HDD or SSD)\n    - [X] Machines with GPUs\n    - [x] Cloud SQL\n    - [x] Instance Group (including regional and Autoscaler)\n    - [x] Google Kubernetes Engine (GKE) cluster\n- Amazon Web Services\n  - [x] EC2 (including inline root, elastic, and ephemeral block storages)\n  - [x] EBS Volumes\n  - [x] RDS\n  - [x] AutoScaling Group\n\nThe following will also be supported soon:\n\n- Amazon Web Services\n  - [ ] Elastic Kubernetes Service (EKS)\n  - [ ] Elastic Container Service (ECS)\n- Azure\n  - [ ] Virtual Machines\n  - [ ] Virtual Machine Scale Set\n  - [ ] SQL\n  \nNB: This list of resources will be extended in the future\nA list of supported resource types is available in the [Scope](doc/scope.md) document.\n\n## Install Carbonifer CLI\n\n### Magic one-liner bash script\n\nUsing bash and curl. By default, it will install the latest version to `/usr/local/bin`:\n\n```bash\ncurl -sfL https://raw.githubusercontent.com/carboniferio/carbonifer/main/install.sh | sudo bash\n```\n\nif you need more flexibility\n\n```bash\nexport DEST_DIR=/path/to/dest/dir\nexport VERSION=v1.2.3\ncurl -sSL https://github.com/username/repo/install.sh | bash\n```\n\n### Go install\n\nIf you have go installed, you can use:\n\n\n```bash\ngo install github.com/carboniferio/carbonifer@latest\n```\n\nGo will automatically install it in your $GOPATH/bin directory which should be in your $PATH.\n\n### Docker alternative\n\nAlternatively, you can use the Docker image:\n\n```bash\ngit clone https://github.com/carboniferio/carbonifer.git\ncd carbonifer\ndocker build -t carbonifer .\ndocker run -it --rm -v \u003cyour_tf_folder_with_config\u003e:/tmp/ carbonifer ./carbonifer --config=/tmp/config.yaml plan /tmp/\n```\n\n### Manual install\n\nDownload the latest release from [releases page](https://github.com/carboniferio/carbonifer/releases/)\n\n## Plan\n\n`carbonifer plan` will read your Terraform folder and estimates Carbon Emissions.\n\n```bash\n$ carbonifer plan\n\n Average estimation of CO2 emissions per instance: \n\n ------------------------------------------- ------- ---------- ------------------------ \n  resource                                    count   replicas   emissions per instance  \n ------------------------------------------- ------- ---------- ------------------------ \n  google_compute_disk.first                   1       1           0.0422 gCO2eq/h        \n  google_compute_instance.first               1       1           33.5977 gCO2eq/h       \n  google_compute_instance.second              1       1           0.4248 gCO2eq/h        \n  google_compute_region_disk.regional-first   1       2           0.0844 gCO2eq/h        \n  google_sql_database_instance.instance       1       2           2.0550 gCO2eq/h        \n  google_compute_subnetwork.first                                unsupported             \n  google_compute_network.vpc_network                             unsupported             \n ------------------------------------------- ------- ---------- ------------------------ \n  Total                                       7                   38.3433 gCO2eq/h       \n ------------------------------------------- ------- ---------- ------------------------ \n\n```\n\nIn case instances are in a managed group (GCP managed instance group, AWS autoscaling group...), the instances appear in the group name, with a count \u003e 1 and emissions are shown for 1 instance. Of course, `Total` will sum all instances of the group:\n\n```bash\n --------------------------------------- ------------------ ------- ------------------------ \n  resource type                           name               count   emissions per instance  \n --------------------------------------- ------------------ ------- ------------------------ \n  google_compute_instance_group_manager   my-group-manager   3        0.5568 gCO2eq/h        \n  google_compute_network                  vpc_network                unsupported             \n  google_compute_subnetwork               first                      unsupported             \n --------------------------------------- ------------------ ------- ------------------------ \n                                          Total              3        1.6704 gCO2eq/h        \n --------------------------------------- ------------------ ------- ------------------------ \n ```\n\nThe report is customizable (text or JSON, per hour, month...), cf [Configuration](#configuration)\n\n\u003cdetails\u003e\u003csummary\u003eExample of a JSON report\u003c/summary\u003e\n\u003cp\u003e\n\n```json\n{\n  \"Info\": {\n    \"UnitTime\": \"h\",\n    \"UnitWattTime\": \"Wh\",\n    \"UnitCarbonEmissionsTime\": \"gCO2eq/h\",\n    \"DateTime\": \"2023-02-18T14:52:08.757999+01:00\",\n    \"AverageCPUUsage\": 0.5,\n    \"AverageGPUUsage\": 0.5\n  },\n  \"Resources\": [\n    {\n      \"Resource\": {\n        \"Identification\": {\n          \"Name\": \"first\",\n          \"ResourceType\": \"google_compute_disk\",\n          \"Provider\": 2,\n          \"Region\": \"europe-west9\",\n          \"Count\": 1\n        },\n        \"Specs\": {\n          \"GpuTypes\": null,\n          \"HddStorage\": \"1024\",\n          \"SsdStorage\": \"0\",\n          \"MemoryMb\": 0,\n          \"VCPUs\": 0,\n          \"ReplicationFactor\": 1\n        }\n      },\n      \"PowerPerInstance\": \"0.76096\",\n      \"CarbonEmissionsPerInstance\": \"0.04489664\",\n      \"AverageCPUUsage\": \"0.5\",\n      \"Count\": \"1\"\n    },\n    {\n      \"Resource\": {\n        \"Identification\": {\n          \"Name\": \"first\",\n          \"ResourceType\": \"google_compute_instance\",\n          \"Provider\": 2,\n          \"Region\": \"europe-west9\",\n          \"Count\": 1\n        },\n        \"Specs\": {\n          \"GpuTypes\": [\n            \"nvidia-tesla-a100\",\n            \"nvidia-tesla-k80\",\n            \"nvidia-tesla-k80\"\n          ],\n          \"HddStorage\": \"0\",\n          \"SsdStorage\": \"1317\",\n          \"MemoryMb\": 87040,\n          \"VCPUs\": 12,\n          \"CPUType\": \"\",\n          \"ReplicationFactor\": 1\n        }\n      },\n      \"PowerPerInstance\": \"733.5648917187\",\n      \"CarbonEmissionsPerInstance\": \"43.2803286114\",\n      \"AverageCPUUsage\": \"0.5\",\n      \"Count\": \"1\"\n    },\n    {\n      \"Resource\": {\n        \"Identification\": {\n          \"Name\": \"second\",\n          \"ResourceType\": \"google_compute_instance\",\n          \"Provider\": 2,\n          \"Region\": \"europe-west9\",\n          \"Count\": 1\n        },\n        \"Specs\": {\n          \"GpuTypes\": null,\n          \"HddStorage\": \"10\",\n          \"SsdStorage\": \"0\",\n          \"MemoryMb\": 4098,\n          \"VCPUs\": 2,\n          \"CPUType\": \"\",\n          \"ReplicationFactor\": 1\n        }\n      },\n      \"PowerPerInstance\": \"7.6091047343\",\n      \"CarbonEmissionsPerInstance\": \"0.4489371793\",\n      \"AverageCPUUsage\": \"0.5\",\n      \"Count\": \"1\"\n    },\n    {\n      \"Resource\": {\n        \"Identification\": {\n          \"Name\": \"regional-first\",\n          \"ResourceType\": \"google_compute_region_disk\",\n          \"Provider\": 2,\n          \"Region\": \"europe-west9\",\n          \"Count\": 1\n        },\n        \"Specs\": {\n          \"GpuTypes\": null,\n          \"HddStorage\": \"1024\",\n          \"SsdStorage\": \"0\",\n          \"MemoryMb\": 0,\n          \"VCPUs\": 0,\n          \"CPUType\": \"\",\n          \"ReplicationFactor\": 2\n        }\n      },\n      \"PowerPerInstance\": \"1.52192\",\n      \"CarbonEmissionsPerInstance\": \"0.08979328\",\n      \"AverageCPUUsage\": \"0.5\",\n      \"Count\": \"1\"\n    },\n    {\n      \"Resource\": {\n        \"Identification\": {\n          \"Name\": \"instance\",\n          \"ResourceType\": \"google_sql_database_instance\",\n          \"Provider\": 2,\n          \"Region\": \"europe-west9\",\n          \"Count\": 1\n        },\n        \"Specs\": {\n          \"GpuTypes\": null,\n          \"HddStorage\": \"0\",\n          \"SsdStorage\": \"10\",\n          \"MemoryMb\": 15360,\n          \"VCPUs\": 4,\n          \"CPUType\": \"\",\n          \"ReplicationFactor\": 2\n        }\n      },\n      \"PowerPerInstance\": \"36.807506875\",\n      \"CarbonEmissionsPerInstance\": \"2.1716429056\",\n      \"AverageCPUUsage\": \"0.5\",\n      \"Count\": \"1\"\n    }\n  ],\n  \"UnsupportedResources\": [\n    {\n      \"Identification\": {\n        \"Name\": \"vpc_network\",\n        \"ResourceType\": \"google_compute_network\",\n        \"Provider\": 2,\n        \"Region\": \"\",\n        \"Count\": 1\n      }\n    },\n    {\n      \"Identification\": {\n        \"Name\": \"first\",\n        \"ResourceType\": \"google_compute_subnetwork\",\n        \"Provider\": 2,\n        \"Region\": \"europe-west9\",\n        \"Count\": 1\n      }\n    }\n  ],\n  \"Total\": {\n    \"Power\": \"780.264383328\",\n    \"CarbonEmissions\": \"46.0355986163\",\n    \"ResourcesCount\": \"5\"\n  }\n}\n```\n\n\u003c/p\u003e\n\u003c/details\u003e\n\n### Existing terraform plan file\n\nIn case you want to read an existing terraform file, you need to pass it as argument. It can either be a raw tfplan or a json plan. \nThis is useful when some variables or credentials are required to run `terraform plan`. In that case `carbonifer plan` won't try to run `terraform  plan` for you, and won't expect to have any credentials or variable set (via env var...)\n\n```bash\ncarbonifer plan /path/to/my/project.tfplan\n```\n\n## Methodology\n\nThis tool will:\n\n1. Read resources from Terraform folder\n2. Calculate an estimation of power used by those resources in Watt per Hour\n3. Translate this electrical power into an estimation of Carbon Emissions depending on\n\nWe can estimate the Carbon Emissions of a resource by taking the electric use of a resource (in Watt-hour) and multiplying it by a carbon emission factor.\nThis carbon emission factor depends on:\n\n- Cloud Provider\n- Region of the Data Center\n- The energy mix of this region/country\n  - Average\n  - (future) real-time\n\nThose calculations and estimations are detailed in the [Methodology document](doc/methodology.md).\n\n## Limitations\n\nWe are currently supporting only\n\n- resources with a significative power usage (basically anything that has CPU, GPU, memory or disk)\n- resources that can be estimated beforehand (we discard for now data transfer)\n\nBecause this is just an estimation, the actual power usage and carbon emission should probably differ depending on the actual usage of the resource (CPU %), and actual grid energy mix (could be weather dependent), ... But that should be enough to make decisions about the choice of provider/region, instance type...\n\nSee the [Scope](doc/scope.md) document for more details.\n\n## Usage\n\n`carbonifer plan [target]`\n\n- `target` can be\n  - a terraform project folder\n  - a terraform plan file (json or raw)\n  - default: the current folder\n\n### Prerequisites\n\n- Terraform :\n  - Carbonifer uses [Terraform](https://www.terraform.io/):\n    - `terrafom` executable available in `$PATH`\n    - if not existing, it installs it in a temp folder (`.carbonifer`)\n  - [versions supported](doc/scope.md#terraform)\n- Cloud provider credentials (optional):\n  - if not provided, if terraform does not need it, it won't fail\n  - if terraform needs it (to read disk image info...), it will get credentials the same way `terraform` gets its credentials\n    - [terraform Google provider](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/getting_started#adding-credentials)\n    - terraform AWS provider\n    - terraform Azure provider\n\n### Configuration\n\n| Yaml key  | CLI flag | Default | Description\n|---|---|---|---|\n| `unit.time` |   | `h` | Time unit: `h` (hour), `m` (month), `y` (year)\n| `unit.power` |   | `w` | Power unit: `W` (watt) or `kW`\n| `unit.carbon` |   | `g` | Carbon emission in `g` (gram) or `kg`\n| `out.format` | `-f \u003cformat\u003e` `--format=\u003cformat\u003e` | `text` | `text` or `json`\n| `out.file` | `-o \u003cfilename\u003e` `--output=\u003cfilename\u003e`|  | file to write report to. Default is standard output.\n| `data.path` | `\u003carg\u003e` |  | path of carbonifer data files (coefficents...). Default uses embedded [files](./internal/data/data/) in binary \n| `avg_cpu_use` |  | `0.5` | planned [average percentage of CPU used](doc/methodology.md#cpu)\n| `log` |  | `warn` | level of logs `info`, `debug`, `warn`, `error`\n\n## Extending Carbonifer\n\nIn order to add support for a new terraform resource type, there is a [mapping mechanism](doc/terraform_mapping.md) where we can declare JQ filters to query the Terraform file and extract the necessary information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarboniferio%2Fcarbonifer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarboniferio%2Fcarbonifer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarboniferio%2Fcarbonifer/lists"}