DEV Community

Olivier Bierlaire
Olivier Bierlaire

Posted on

Carbon Aware Cloud

Microsoft recently announced that Xbox will now be "Carbon Aware". It will download updates during periods of low carbon intensity on the power grid.

Can we imagine doing the same for a cloud infrastructure? Can we imagine a carbon aware cloud? Public cloud providers are constantly improving their environmental impact by, for example, saving water or building solar plants. However, the virtual machines we spin up or the computing tasks we trigger are completely up to us. And there is room for improvement.

What is the problem with data centres?

According to the International Energy Agency, data centres consume between 220 and 320 terawatt-hours (TWh) of electricity, which is around one percent of the world's electricity demand in 2021. Data centres account for around 0.3% of all global CO2 emissions. While this number may seem small, it can be compared to the total emissions of countries like France, UK or Australia!

Projections published by Nature suggest that the electricity demand of Information and Communications Technology (ICT) will jump to 20% of global electricity. To put this in perspective, ICT currently has the same carbon footprint as the aviation industry, and data centres account for 20% of it according to the Shift Project. This share is only expected to grow!

Energy Forcast of ICT - Nature

Energy Forcast of ICT - Nature

Distribution of energy consumption per source for production and use of digital services in 2017 - the Shift Project

First, measure your cloud carbon footprint

There are tools available to analyse the carbon footprint of your cloud infrastructure. Major public cloud providers have released tools for this purpose:

Various open-source initiatives, like Cloud Carbon Footprint, can analyse your cloud provider bill, get resource usage, and estimate carbon emissions.

Other tools, like Scaphandre, rely on monitoring agents to measure the electric consumption of your machines.

There are many methodologies to estimate power consumption of your cloud resources. Basically, if you know the underlying models of the CPU, memory, disk, or GPU, you need to multiply it by their usage percent over time, and you will have the power consumption in kilowatt-hours (kWh).

Having the power consumption is the most difficult part. Once you have it, there are various methods to estimate CO2 emissions from it.

SCI Formula - Green Software Foundation

The key part is multiplying your power consumption (E) by the carbon intensity of the electricity consumed (I).

But, what’s the carbon intensity of the electricity ? Cloud provider might provide some net value, taking in account their effort to offset carbon (basically net zero according to Google), but realistically electricity used by data center comes from the regional grid. So, depending on where the data center is located, electricity can be more or less “clean”:

Carbon Intensity of electricity, 2022,

We can even get a real time value from projects like Electricity Maps

Real time [Electricity Maps](

Then, reduce your cloud carbon footprint

Once you know how to measure your carbon footprint, it's time to take action! The first thing that comes to mind is making software more energy efficient. However, on the infrastructure level, there are choices that can be made.

Move to an Hyperscaler provider

Moving to a hyperscaler cloud provider can have a significant impact. Public cloud providers, such as AWS, GCP, and Azure, are constantly working to lower energy bills by improving water cooling, among other things.

Choose your region wisely

According to Google, hosting in Paris can result in a carbon footprint as low as 59 gCO2eq/kWh, while in Frankfurt it can jump to 269. By choosing a "greener" region in the same neighbourhood, the impact on carbon footprint can be massive!

Moving server - Green Software Foundation

Follow the sun

Carbon intensity varies a lot during the day because of renewable energy which depends on weather conditions. During a windless night, carbon intensity is worse than during a windy and sunny day!

Carbon intensity over time - Green Software Foundation

Scheduling a heavy task, like machine learning, where it’s daylight can be a powerful way to reduce the carbon footprint of asynchronous tasks.

Leverage Infrastructure as Code (IaC)

Infrastructure as Code (IaC) tools like Terraform enable infrastructure automation. Your infrastructure is described in a machine-readable file, which can be analysed and generated (templates, variables). Changing the region of an infrastructure could be as simple as changing the value of a variable.

By reading these Terraform files, tools like Carbonifer can compute the size and number of virtual machines in your infrastructure and estimate the carbon footprint in gCO2eq/h.

Integrating such a tool with your Continuous Integration (CI) could raise alerts when you reach a threshold of CO2 emission estimation for any planned changes to your infrastructure (thanks to GitOps).

[Carbonifer]( screenshots

Accept loss of quality

There is virtually no limit to the performance of your software, regardless of the cost in money. Having more and bigger machines can ensure customer satisfaction with features like Ultra HD streaming and instant responsiveness. However, during a dark, cold winter when electricity relies on fossil fuels, it may not make sense to prioritise these features. Cloud companies could reduce their quality of service slightly to remain within their climate commitments. Tools could be developed to resize "autoscaling groups” when the carbon intensity of the cloud is high.

Carbon Aware Cloud

Although there is not yet a fully integrated solution for a carbon-aware cloud, various tools, automations and methodologies can help in the following ways:

  • Estimate the CO2 emissions of a deployment
  • Analyse the Carbon Footprint of an existing infrastructure
  • actively pilot your infrastructure according to the carbon intensity of the grid

By changing the hosting region, selecting a better time of day, or accepting a lower quality and automating these actions, there are ways to reduce our cloud carbon footprint.

Top comments (0)