By Nicholas Burden, Wan Ping Chua, Adom Taylor and Herman Liu – TensorIoT
By Aditi Suresh and Edmund Chute – AWS

Connect with TensorIoT-2

Carbon accounting refers to the method of identifying, quantifying, and reporting the carbon footprint from various sources of greenhouse gas (GHG) emissions associated with an organization’s operations. These emissions include direct emissions from onsite activities (Scope 1), indirect emissions from purchased energy (Scope 2), and emissions from the value chain, including suppliers and customers (Scope 3).

Organizations are under increasing pressure to report and reduce their carbon footprint due to mounting concerns from regulators, investors, and consumers. Chief Sustainability Officers (CSOs) and their teams often face challenges in gathering and analyzing the necessary data for accurate carbon footprint measurement, company-wide reporting, and decarbonization planning to meet sustainability targets.

The resource burden of data capture, analysis, and reporting can result in low accuracy of carbon footprint measurement and lack of actionable insights for decarbonization. This is where TensorIoT, with its proven expertise in sustainability and technology, steps in to make a difference.

As an AWS Specialization Partner and 2022 AWS Sustainability Partner of the Year for North America, TensorIoT is at the forefront of integrating sustainability solutions into the digital landscape. Its team of experts specializes in developing and implementing cutting-edge tools to help businesses tackle their sustainability challenges, with a focus on carbon accounting and decarbonization.

By leveraging the Guidance for Carbon Accounting on AWS, TensorIoT enables organizations to accelerate the creation of an automated carbon footprint measurement system. This reduces reporting time and increases data accuracy, delivering critical and actionable insights for sustainability teams.

Unlocking the Power of Carbon Accounting Solutions on AWS

The Guidance for Carbon Accounting on AWS is built upon the Guidance for Sustainability Insights Framework on AWS, which provides a set of well-architected technical accelerators for the carbon footprint measurement application.

The guidance provides the following advantages:

  • Adaptability: Offers the flexibility to manage emission factors from multiple sources and establish or adapt calculations in response to evolving methods and standards.
  • Transparency and auditability: All data sources are versioned, with calculation inputs and outputs logged. This helps with the traceability and repeatability of calculations.
  • Data security and integrity: Adheres to security best practices, including least privilege permissions, data encryption, and secure key management.
  • Efficiency and accuracy: By automating data collection and calculation, it reduces the burden of manual data handling and lowers the risk of human errors.

Carbon Footprint Measurement Application for Scope 2 Emissions

TensorIoT has leveraged the Guidance for Carbon Accounting on AWS to create a carbon footprint measurement application focused on Scope 2 emissions from electricity consumption. Designed for Sustainability Managers and Facility Managers, this application enables users to track and compare Scope 2 emissions from electricity consumption across their portfolio of facilities in the United States.

Users input the facility zip code and electricity consumption (in kWh) or facility square footage, and the application calculates the resulting Scope 2 emissions per facility based on the electricity grid mix of the region.

For this example walkthrough, emission factors and building consumption data are sourced from the U.S. Environmental Protection Agency (EPA) Emissions & Generation Resource Integrated Database (eGRID) and the U.S. Energy Information Administration (EIA) Commercial Buildings Energy Consumption Survey.

In the next section, we provide a technical walkthrough of the solution deployment and setup process, showcasing how TensorIoT experts can help a customer to build their own carbon accounting solution on AWS.

Technical Walkthrough

Using the below steps, you’ll deploy a React-based application that will use the Guidance for Carbon Accounting on AWS to help calculate the Scope 2 carbon footprint of facilities from electricity consumption.

You will deploy the solution via AWS Cloud Development Kit (AWS CDK) utilizing a single-tenant and single-environment deployment. Due to the multiple build steps and tooling requirements to build and deploy the solution, the solution creates an AWS CodeBuild project. You can also deploy the solution manually by following the deployment walkthrough.


  • AWS account
  • Knowledge of AWS CDK
  • Familiarity with AWS services and Guidance for Sustainability Insights Framework on AWS
  • Administrative permissions to run CDK bootstrap and CDK deploy

Setting up the Environment

  1. Install Node.
  2. Install AWS Command Line Interface (CLI).
  3. Install AWS CDK.
  4. Configure AWS profile with correct account information.
  5. Clone repository.
  6. Open Terminal in repository root folder.
  7. Run npm install.
  8. Run cdk bootstrap aws://ACCOUNT-NUMBER/REGION
  9. Modify config.json to setup environment:
    • Account – AWS account number.
    • Region – AWS deployment region.
    • TenantID – String to use the as Sustainability Insights Framework tenant ID.
    • adminEmail – Email used to create admin user and email password.
    • environmentName – Name of deployment environment.
  10. Run cdk deploy SifCodebuildStack [–profile=”PROFILE_NAME”] which will create a CodeBuild project called “SifBuildDeploy” that needs to be run once to build and deploy the solution framework.
  11. Run aws codebuild start-build –project-name SifBuildDeploy to run the build project.
  12. You’ll receive your admin password via email. This will be needed to access the application as well as to configure the solution deployment.
  13. Once the solution framework is deployed, run the script to set its initial configuration.
  14. Run cdk deploy CarbonAccountingPortalStack [–profile=”PROFILE_NAME”]

The scripts run in Step 14 are used to set up our reference tables, calculation logic, and pipeline within the solution framework. We create lookup tables, calculations, and a pipeline which is run from the React app.


For this walkthrough, you’ll use GHG Protocol Scope 2 Guidance to calculate location-based Scope 2 emissions, determined by averaged emissions data within a specific geographic boundary and timeframe. Precise activity data comes from metered electricity consumption or utility bills measured in MWh or kWh units. In the absence of such data, you can estimate electricity consumption based on average data for specific facility types. To assign the correct emission factor, you need to collect facility zip codes.

Reference datasets and emission factors were identified to support this use case. The reference dataset identified from the EIA Commercial Buildings Energy Consumption Survey 2018 provides the estimated annual facility electricity consumption in kilowatt-hours per square foot, per year.

This reference dataset (see Figure 1) is stored as “BuildingToConsumption” and was imported from the setup script using the following call:

   "name": "BuildingToConsumption",
   "description": "Lookup table for building type to consumption",
   "datasetHeaders": [
   "data": "BuildingActivity,BuildingConsumptionKwhPerSqFtPerYearnEducation,9.1nFood service,40.575nHealth care,23.375nInpatient,28.1nOutpatient,17.5nLodging,14.225nMercantile,16.375nRetail (other than mall),13.075nEnclosed and strip malls,19.275nOffice,13.425nPublic assembly,11.425nReligious worship,4.725nService,7.4nWarehouse and storage,5.8nOther,31.55"


Figure 1 – Snapshot of “BuildingToConsumption” reference dataset.

Similar steps are applied to import additional reference datasets required for the calculations. The full JSON file can be found in the GitHub repository. A reference dataset named “BuildingUnitConversion” must be created to allow users to input square footage in either square feet (sqft) or square meters (sqm) by facilitating unit conversions.


Figure 2 – Snapshot of  “BuildingUnitConversion” reference dataset.

Similarly, users may provide electricity consumption in kilowatt-hours, megawatt-hours, or a Megajoules (MJ), so a reference dataset needs to be created to enable unit conversions. This reference dataset is stored as “ElectricityUnitConversion.”


Figure 3 – Snapshot of  “ElectricityUnitConversion” reference dataset.

The U.S. electricity grid emission factors are broken down into regions known as eGRID subregions. The correct eGRID subregion to assign is based on the U.S. postal code of the facility, as provided by the EPA Emissions & Generation Resource Integrated Database 2023. This reference dataset is stored as “ZipCodeToEfactor.”


Figure 4 – Snapshot of  “ZipCodeToEfactor” reference dataset.

In addition to the reference datasets previously mentioned, it’s necessary to incorporate the EPA 2023 Total Output Emission Rate emission factors from the EPA eGRID database of 2023. To do this, the solution imports the emission factor using the following call, which generates a single row per emission factor, complemented by the specified column headers.

The following is sent for each factor:

   "name": "InsertName",
   "description": "Insert Description",
   "impacts": {
     "CO2eq": {
       "name": "KG C02 eq per MWh",
       "attributes": { "outUnit": "KG C02 eq per MWh" },
       "components": {
         "co2": { "key": "co2", "value": 1000, "type": "pollutant" },
         "ch4": { "key": "ch4", "value": 1000, "type": "pollutant" },
         "no2": { "key": "no2", "value": 1000, "type": "pollutant" }

Here, Impact_Factor_Name is the name of the impact factor; in this case, the eGRID subregion acronym. Impact_unit is the emission factor unit, while Ref_unit stands for the activity data’s reference unit, which is electricity consumption in this case.

Finally, Total Co2e, co2_co2e, ch4_co2e, and n2o_co2e convey the emission factors as total carbon-dioxide equivalent, as well as the carbon dioxide, methane, and nitrous oxide components (expressed in co2-equivalent).


There are two use cases for the calculations:

  • When electricity consumption is provided: Calculate the corresponding carbon emissions using the electricity consumption and the facility zip code.
  • When electricity consumption is not provided: Estimate electricity consumption given a facility type and facility square footage. Once estimated, use the facility zip code to calculate the estimated carbon emissions.


Figure 5 – User input form for facility-level electricity data collection.

First, calculate the building area using:


This LOOKUP function fetches the conversion factor from “BuildingAreaConversionToSqFt” and multiplies it with the “building_area.”

Second, find the energy consumption per square foot using:


This function retrieves the energy consumption based on the user’s input and multiplies it by the square footage to get the total energy consumption.

Convert this energy consumption to MWh using:


Here, a lookup function converts electricity units to MWh by multiplying the conversion factor with the “electricity_value.”

Finally, calculate emissions from total electricity consumption:

IMPACT(LOOKUP(:zipCode,'ZipCodeToEfactor','ZipCode','EgridSubRegion',group='/'),'KG C02 eq per MWh',:impactType)*:electricityMwh

This formula identifies the correct eGRID region, then uses the IMPACT function to return a specific emission factor. This is multiplied by the total electricity consumption to compute the emissions.


This pipeline calculates carbon emissions from the building activity, including estimations for location-based Scope 2 emissions from electricity. An “if” clause chooses between calculating electricity consumption from building area or using user-provided electricity usage data. The complete pipeline is accessible in the GitHub repository.


Users can calculate emissions for up to five facilities at once. After selecting Calculate, results are displayed both individually and as a total for monthly comparison across facilities.


Figure 6 – Emissions (kg CO2e) display by month and by facility.

Users can also download the results in .csv format.


Figure 7 – Sample outputs in .csv format.


In this post, we walked through a step-by-step technical solution deploying a React-based web application using the Guidance for Carbon Accounting on AWS that demonstrated the power of AWS for helping to calculate the Scope 2 carbon footprint of facilities.

By utilizing AWS services, TensorIoT has successfully delivered a carbon accounting application on AWS by automating the intricate calculations as well as tailoring the application to suite the unique requirements of your organization.

If you’re looking to utilize AWS to reach your sustainability goals, TensorIoT collaborates with businesses of all scales to plan and establish a tailored sustainability solution that tackles your unique challenges and ambitions. Reach out to TensorIoT for guidance on your journey towards a more sustainable future, one step at a time.

You can learn more about TensorIoT in AWS Marketplace.


TensorIoT – AWS Partner Spotlight

TensorIoT is an AWS Specialization Partner that enables digital transformation and greater sustainability for customers through IoT, AI/ML, data and analytics, and app modernization.

Contact TensorIoT | Partner Overview | AWS Marketplace | Case Studies