<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Olivier Bierlaire</title>
    <description>The latest articles on Forem by Olivier Bierlaire (@obierlaire).</description>
    <link>https://forem.com/obierlaire</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2900%2FK--fPoU-.jpg</url>
      <title>Forem: Olivier Bierlaire</title>
      <link>https://forem.com/obierlaire</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/obierlaire"/>
    <language>en</language>
    <item>
      <title>Carbon Aware Cloud</title>
      <dc:creator>Olivier Bierlaire</dc:creator>
      <pubDate>Tue, 07 Mar 2023 13:33:48 +0000</pubDate>
      <link>https://forem.com/obierlaire/carbon-aware-cloud-3h2e</link>
      <guid>https://forem.com/obierlaire/carbon-aware-cloud-3h2e</guid>
      <description>&lt;p&gt;Microsoft recently &lt;a href="https://news.xbox.com/en-us/2023/01/11/xbox-carbon-aware-console-sustainability/"&gt;announced&lt;/a&gt; that Xbox will now be "Carbon Aware". It will download updates during periods of low carbon intensity on the power grid. &lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is the problem with data centres?
&lt;/h2&gt;

&lt;p&gt;According to the &lt;a href="https://www.iea.org/reports/data-centres-and-data-transmission-networks"&gt;International Energy Agency&lt;/a&gt;, 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 &lt;a href="https://www.climatewatchdata.org/ghg-emissions?breakBy=countries&amp;amp;chartType=line&amp;amp;end_year=2019&amp;amp;gases=co2&amp;amp;regions=AUS%2CFRA%2CGBR%2CDEU&amp;amp;sectors=total-including-lucf&amp;amp;start_year=1990"&gt;France, UK or Australia&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;Projections published by &lt;a href="https://www.nature.com/articles/d41586-018-06610-y"&gt;Nature&lt;/a&gt; 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 &lt;a href="https://theshiftproject.org/en/article/lean-ict-our-new-report/"&gt;Shift Project&lt;/a&gt;. This share is only expected to grow!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--85RphE-z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2fvt58n9m0u4zk5hq7kh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--85RphE-z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2fvt58n9m0u4zk5hq7kh.png" alt="Energy Forcast of ICT - Nature" width="800" height="627"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Energy Forcast of ICT - &lt;a href="https://www.nature.com/articles/d41586-018-06610-y"&gt;Nature&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uT-cOX4j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qmko1r0zbvfvkw0pdzyd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uT-cOX4j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qmko1r0zbvfvkw0pdzyd.png" alt="Distribution of energy consumption per source for production and use of digital services in 2017 - the Shift Project" width="538" height="650"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  First, measure your cloud carbon footprint
&lt;/h2&gt;

&lt;p&gt;There are tools available to analyse the carbon footprint of your cloud infrastructure. Major public cloud providers have released tools for this purpose:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS &lt;a href="https://aws.amazon.com/aws-cost-management/aws-customer-carbon-footprint-tool/"&gt;Carbon Footprint Tool&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Google Cloud &lt;a href="https://cloud.google.com/carbon-footprint"&gt;Carbon Footprint&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Microsoft Azure &lt;a href="https://azure.microsoft.com/en-gb/blog/microsoft-sustainability-calculator-helps-enterprises-analyze-the-carbon-emissions-of-their-it-infrastructure/"&gt;Sustainability Calculator&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Various open-source initiatives, like &lt;a href="https://www.cloudcarbonfootprint.org/docs/methodology/#appendix-iii-gpus-and-minmax-watts"&gt;Cloud Carbon Footprint&lt;/a&gt;, can analyse your cloud provider bill, get resource usage, and estimate carbon emissions.&lt;/p&gt;

&lt;p&gt;Other tools, like &lt;a href="https://hubblo-org.github.io/scaphandre-documentation/index.html"&gt;Scaphandre&lt;/a&gt;, rely on monitoring agents to measure the electric consumption of your machines.&lt;/p&gt;

&lt;p&gt;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).&lt;/p&gt;

&lt;p&gt;Having the power consumption is the most difficult part. Once you have it, there are various methods to estimate CO2 emissions from it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QZhcWjYS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uhls3lbecnviu1g3rw3i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QZhcWjYS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uhls3lbecnviu1g3rw3i.png" alt="SCI Formula - Green Software Foundation" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The key part is multiplying your power consumption (E) by the carbon intensity of the electricity consumed (I).&lt;/p&gt;

&lt;p&gt;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 &lt;a href="https://cloud.google.com/sustainability/region-carbon"&gt;Google&lt;/a&gt;), 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”:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RI5MqJec--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i0qrhh4pb2tbwq18mnph.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RI5MqJec--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i0qrhh4pb2tbwq18mnph.png" alt="Carbon Intensity of electricity, 2022, OurWorldData.org" width="800" height="696"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can even get a real time value from projects like &lt;a href="https://app.electricitymaps.com/map"&gt;Electricity Maps&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iA1qQpQ---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m0crzba0j5mu4wges8qy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iA1qQpQ---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m0crzba0j5mu4wges8qy.png" alt="Real time [Electricity Maps](https://app.electricitymaps.com/map)" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Then, reduce your cloud carbon footprint
&lt;/h2&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h3&gt;
  
  
  Move to an Hyperscaler provider
&lt;/h3&gt;

&lt;p&gt;Moving to a &lt;a href="https://www.gartner.com/en/newsroom/press-releases/2022-01-24-gartner-predicts-hyperscalers-carbon-emissions-will-drive-cloud-purchase-decsions-by-2025"&gt;hyperscaler&lt;/a&gt; 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.&lt;/p&gt;

&lt;h3&gt;
  
  
  Choose your region wisely
&lt;/h3&gt;

&lt;p&gt;According to &lt;a href="https://cloud.google.com/sustainability/region-carbon"&gt;Google&lt;/a&gt;, 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!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5r-A77h_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wz6ptyb3hncn5t28wpr2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5r-A77h_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wz6ptyb3hncn5t28wpr2.png" alt="Moving server - Green Software Foundation" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Follow the sun
&lt;/h3&gt;

&lt;p&gt;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!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GOxuHtSS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/42k4u9mnhblqljkfqx52.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GOxuHtSS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/42k4u9mnhblqljkfqx52.png" alt="Carbon intensity over time - Green Software Foundation" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Leverage Infrastructure as Code (IaC)
&lt;/h3&gt;

&lt;p&gt;Infrastructure as Code (IaC) tools like &lt;a href="https://www.terraform.io/"&gt;Terraform&lt;/a&gt; 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.&lt;/p&gt;

&lt;p&gt;By reading these Terraform files, tools like &lt;a href="https://github.com/carboniferio/carbonifer"&gt;Carbonifer&lt;/a&gt; can compute the size and number of virtual machines in your infrastructure and estimate the carbon footprint in gCO2eq/h.&lt;/p&gt;

&lt;p&gt;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).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ps5cCOfN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r18ynzrzb5d4gal5h8mp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ps5cCOfN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r18ynzrzb5d4gal5h8mp.png" alt="[Carbonifer](https://carbonifer.io/) screenshots" width="800" height="529"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Accept loss of quality
&lt;/h3&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h2&gt;
  
  
  Carbon Aware Cloud
&lt;/h2&gt;

&lt;p&gt;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:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Estimate&lt;/strong&gt; the CO2 emissions of a deployment&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Analyse&lt;/strong&gt; the Carbon Footprint of an existing infrastructure&lt;/li&gt;
&lt;li&gt;actively &lt;strong&gt;pilot&lt;/strong&gt; your infrastructure according to the carbon intensity of the grid&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;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.&lt;/p&gt;

</description>
      <category>cloud</category>
      <category>devops</category>
      <category>terraform</category>
      <category>carbonfootprint</category>
    </item>
    <item>
      <title>OPSoletes: Are Sysadmins/Ops becoming things of the past?</title>
      <dc:creator>Olivier Bierlaire</dc:creator>
      <pubDate>Wed, 08 Feb 2017 13:26:32 +0000</pubDate>
      <link>https://forem.com/obierlaire/opsoletes</link>
      <guid>https://forem.com/obierlaire/opsoletes</guid>
      <description>&lt;p&gt;At first, I was a developer. One day the guy in charge of the infrastructure/ops resigned and my boss asked me to take over his duties. Well… The handover was basically me asking dumb questions like “What the hell is SystemD?”, “Why do you want me to use docker?”, “Amazon? The bookstore?”… Again, I was a dev…&lt;/p&gt;

&lt;p&gt;When he left, I still had no idea of what needed to be done in order to host our brand new web application. I learned.&lt;/p&gt;

&lt;p&gt;One day, we asked an AWS expert to consult us. He taught me how to deploy an entire AWS EC2 infrastructure in few hours. He showed me how cool are AutoScaling Groups and Cloud-init/Userdata. And we started a new infrastructure, from scratch, with only 3 basic concepts:&lt;/p&gt;

&lt;h2&gt;
  
  
  User-data/Cloud-init
&lt;/h2&gt;

&lt;p&gt;When you spin a new instance up in the cloud, you can add a little script. That script (user-data or cloud-init) is executed as soon as the machine is up. You can use it in order to set up your Linux server, install packages, get your code and run it!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
# Install NodeJS
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
# Install git
sudo apt-get install -y git
# Get our code
git archive --format=tar --remote=https://login:pass@github.com/mycompany/myproject.git HEAD | tar xf -
# Run the app
cd myproject
npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  AutoScaling group (ASG)
&lt;/h2&gt;

&lt;p&gt;Even if you don't need to “Auto-scale”, it is an elegant way to manage your machine(s). Imagine you have an API server, you need 3 instances in order to be highly available, you just tell your ASG to start 3 machines (using userdata to set up and run your api server). If you need 4, scale-it to 4 in one click. When a machine dies (memory full, etc), it will automatically be replaced! You need to upgrade, no problem, once you have updated your ASG (a new Launch configuration actually), you can kill one instance, it will be replaced by the new one with your new version! yay! Rolling upgrade!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1600%2F1%2ABEjp9Pgf9SmaIGL_JjMDEg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1600%2F1%2ABEjp9Pgf9SmaIGL_JjMDEg.png" alt="Auto Scaling Groups"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Elastic Load Balancer
&lt;/h2&gt;

&lt;p&gt;In order to have one public endpoint you can place an Elastic Load Balancer in front of your Autoscaling Group. It will also perform health checks for helping your ASG replacing unhealthy instances. Done: you have a single public endpoint!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fcdn.blog.celingest.com%2Fwp-content%2Fuploads%2F2013%2F12%2FAWS_Auto_Scaling_using_EC2_Management_Console.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fcdn.blog.celingest.com%2Fwp-content%2Fuploads%2F2013%2F12%2FAWS_Auto_Scaling_using_EC2_Management_Console.png" alt="ELB and ASG"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Seriously, the AWS consultant helped my workmates and I to set this up in one afternoon. &lt;em&gt;One afternoon.&lt;/em&gt; You don't need more to have a robust infrastructure, no need to have a multi-year experienced ops background.&lt;/p&gt;

&lt;p&gt;Of course, we also needed databases, a file storage, etc. The key is Managed Services. Cloud providers like Amazon or Google can provide it in one click. No need to take care of backup, logs, patch, etc. They will manage it for you.&lt;br&gt;
By the end of the day, even if I was the Designated Ops Survivor, the entire dev team was able to deploy a new version of our code on our servers, on a real robust, highly available infrastructure, auto-managed by the team.&lt;/p&gt;

&lt;p&gt;My job as ops expert became more about exploring new techs rather than dealing with daily issues like backups, patches, installing new versions of our app, etc.&lt;/p&gt;

&lt;p&gt;That's why I'm thinking Sysadmins, ops, etc as a thing of the past. A few companies will probably still need them. Amazon need some in order to offer us a nice sparkling AWS Cloud! But if you are a start-up, creating a web application as a lot of us, you don't need to deal with linux patches. You need to focus on your business. With Cloud providers and a DevOps oriented organization: an infrastructure can be managed by the dev team. You can use the leverage of the IAAS (infrastructure as service) without the burden of sysadmin daily duties.&lt;/p&gt;

&lt;p&gt;Are ops OPSolete?&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>autoscalinggroup</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
