Over the past decade, escalating environmental concerns have reverberated across the globe. The contamination of natural resources and the release of greenhouse gases are driving profound shifts in our climate and unleashing more frequent and severe natural phenomena. In light of these challenges, mastering the art of calculating CO2 emissions has become imperative—a pivotal step toward impactful action and the mitigation of our carbon footprint.
Against this backdrop, major technology enterprises have recognized their role and obligation in the realm of environmental stewardship. They have developed digital tools and solutions that empower the public to gauge their own CO2 emissions based on the services they deploy across diverse cloud platforms.
In the subsequent sections, I will introduce an innovative digital solution that offers precise CO2 emission calculations for your services across multiple cloud providers such as AWS, GCP, and Azure. This tool affords you a transparent view of the environmental ramifications posed by your applications, enabling you to make informed and conscientious choices. Moreover, it seamlessly integrates into your applications as an agent, streamlining the process of monitoring and reducing your carbon footprint.
Cloud Carbon Footprint
Cloud Carbon Footprint, An open-source application designed to facilitate the estimation of energy consumption in kilowatt hours and carbon emissions in metric tons of CO2e stemming from the utilization of public cloud services. In technical terms, Cloud Carbon Footprint leverages Athena to execute queries on an S3 repository housing the data from AWS Billing's Cost & Usage Reports.
Empowered by this tool, you can generate comprehensive reports on usage and expenses. You can explore the application's demo here, but prior to that, let's walk through the correct setup process.
Steps to set up Cloud Carbon Footprint
-
As previously highlighted, Cloud Carbon Footprint is an open-source tool, and its repository resides on GitHub. I suggest creating a designated folder to download the project, which will serve as your workspace. In my case, I am utilizing Linux and will initiate the creation of a folder through the command line using the well-known 'mkdir clone-example2' command.
-
We proceed to clone the project from the GitHub repository, utilizing the 'latest' branch encompassing the most recent project updates. To achieve this, execute the subsequent command: git clone --branch latest https://github.com/cloud-carbon-footprint/cloud-carbon-footprint.git.
-
You can inspect the code using your preferred text editor. In my case, I have Visual Studio Code open. Upon examining the code, you'll come across a toolkit offering several ways to launch the project. You'll also find a 'docker-compose.yml' file, where you can tweak some variables for quick deployment. The front-end, meaning the client interface, is developed with React, and the package manager used is Yarn, which is as well-known and popular as NPM. Moreover, the project provides various deployment methods for different cloud platforms, as well as the option to run it locally.
-
The project adheres to a monolithic architecture where both the backend and frontend are amalgamated within the same project. This setup enables interfacing with various cloud platforms via their respective command-line interfaces (CLIs). For our present purpose, we will construct the project locally to establish a link with AWS. The initial step involves launching the dependencies using Yarn.
Here's how you can build the project locally:
- Navigate to the directory where you downloaded the project from GitHub: cd cloud-carbon-footprint/
- Once within the folder, execute the following two commands on the same line: yarn install && yarn guided-install"
Cloud Carbon Footprint now presents the capability to establish connections with various clouds, including AWS, GCP, Azure, MongoDB, among others. It prompts you to select the configuration of your choice. For this instance, we'll opt for AWS, as it's the available cloud option. Upon selecting AWS, it will prompt you for the AWS account ID, where you'll input the relevant identification information. Subsequently, it will request the AWS Account Name
-
Set the AWS Region for the designated AWS account. To accomplish this, you must create a user within AWS endowed with access to the billing console. Additionally, you'll need to establish a role equipped with policies enabling Athena to execute queries. Furthermore, the creation of a bucket is required, one that Athena can leverage for query execution, with appropriate permissions conferred to access the AWS billing console.
Cloud Carbon Footprint Integration Architecture on AWS
As illustrated in the diagram below, Cloud Carbon Footprint (CCF) collaborates seamlessly with AWS. When following the architecture from left to right, CCF initiates a request to Athena, which subsequently transmits the data to S3. Athena proceeds to retrieve the outcomes and logs them within the database, facilitating the monitoring of CO2 emissions. These outcomes manifest in the CCF frontend
If everything is OK and the information is correct, just say "yes".
Following this, Cloud Carbon Footprint (CCF) will prompt for the subsequent information:
Name of the database in Athena.
Name of the table in Athena.
The Query to be executed in Athena.
The name of the bucket where Athena will carry out the queries.
Given that we are operating locally, the presence of the AWS CLI is imperative. This command-line tool facilitates the establishment of a connection to AWS.
AWS CLI relies on an 'Access Key ID' and a 'Secret Access Key' for authentication and access to AWS account resources. To ensure seamless compatibility with Cloud Carbon Footprint, these credentials must be configured within the CLI.
Once all the necessary configurations are in place and the AWS connection is established, you can initiate the project using the 'yarn start' command. This action will set the project in motion, enabling you to begin utilizing Cloud Carbon Footprint
If the service doesn't display information immediately, there's no need for concern. Athena requires time to collect and process data, so it might take approximately 24 hours for the data to become accessible. After this time span has elapsed and the data becomes available, you can opt for the AWS provider within Cloud Carbon Footprint. Drawing from the accumulated information, the initial graph will depict the utilization of your cloud account.
Keep in mind that the precise data collection duration can fluctuate based on the volume of information necessitating processing. Once the data is prepared, you can access and analyze it within the Cloud Carbon Footprint interface
In the initial graph, Cloud Carbon Footprint visually represents the CO2 emissions generated per-kilowatt-hour of usage alongside the corresponding infrastructure costs. The tool primarily emphasizes showcasing CO2e generation—an expression denoting greenhouse gas emissions in units of carbon dioxide equivalent.
The image below elucidates that the usage volume for the month aligns with emissions comparable to the effect of around 20,934 mobile phones receiving battery charges. This presentation offers valuable insights into the environmental consequences of energy consumption and its translation into CO2e emissions.
It's noteworthy that data accuracy can fluctuate based on several variables. Nonetheless, the most pertinent aspect here is the measurement of CO2e generation, which serves as a pivotal indicator for comprehending the environmental repercussions of our cloud-related activities.
Beyond presenting the aggregate CO2e generation, Cloud Carbon Footprint furnishes comprehensive insights into each service deployed within the account, spotlighting those that contribute the most to carbon emissions.
In this particular instance, the tool has pinpointed the lambdas within the account that generate the highest CO2 emissions. This knowledge proves invaluable for grasping how individual services contribute to the carbon footprint of the cloud infrastructure.
Equipped with this information, users gain the ability to discern services that wield a more substantial environmental influence. If deemed necessary, they can explore avenues to optimize or curtail the utilization of these services, thereby mitigating carbon emissions.
As evident, Cloud Carbon Footprint emerges as an extensively encompassing tool that facilitates the integration and oversight of CO2 emissions from diverse clouds via a unified dashboard. It's pertinent to recognize that prominent public cloud providers like Microsoft Azure, AWS, and Google Cloud Platform feature their individual tools for assessing gas emissions originating from services deployed on their respective platforms. Subsequently, I will outline and provide a general description of each of these tools .
Public cloud-native tools capable of carbon footprint monitoring
- Emissions Impact Dashbord: This Microsoft tool facilitates the estimation of greenhouse gas emissions within Azure. It delivers precise calculations of diverse greenhouse gas types, enabling users to make informed choices that curtail their carbon footprint and foster the adoption of more environmentally sustainable practices when utilizing Azure services.
- Carbon Footprint Service: Google Cloud Platform (GCP) launched this tool in 2021 with the aim to help measure the amount of CO2 produced in GCP due to the use of its cloud services and resources.
- AWS Carbon Footprint: AWS has developed its own tool as a testament to its dedication to sustainability and environmental accountability. This tool empowers customers with the capacity to gauge and comprehend the climate repercussions of their cloud operations.
At PALO IT, we stand at the forefront of technology and digital innovation. Our mission is to elevate your business while nurturing our environment. We harness premier digital tools to secure a positive influence. Reach out to us and embark on your journey towards sustainability.