---
title: "Tech Tip #39: Put your infrastructure in code"
description: "You can't cut waste you can't see."
url: https://greencode.ai/tech-tips/39-put-your-infrastructure-in-code/
---

# Tech Tip #39: Put your infrastructure in code

**You can't cut waste you can't see.**

[Watch the video](https://media.greencode.ai/shorts/put-your-infrastructure-in-code-cb0806e3728c.mp4)

Video created by [explainapaper.com](https://explainapaper.com/?utm_source=greencode.ai&utm_medium=film&utm_campaign=made-by)

### The problem

An estate built by hand in consoles hides oversized, duplicated and forgotten resources. Nobody can review what is not written down.

### The fix you can use today

- Describe the estate as infrastructure as code, one reviewed source of truth.
- Review it like application code: look for idle, oversized and duplicated resources.
- Add policy checks that flag oversized or untagged resources before they deploy.

GreenCode researchers found that infrastructure written as code is easier to check, shrink and rebuild.

### Tools that help

- [Terraform / OpenTofu](https://opentofu.org/docs/?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode): declarative infrastructure as code: the whole estate written down, reviewable and versioned
- [Checkov](https://www.checkov.io/?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode): policy-as-code checks on infrastructure definitions before they are deployed
- [Cloud Carbon Footprint](https://www.cloudcarbonfootprint.org/?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode): estimates the energy and emissions of AWS, Azure and Google Cloud usage from billing and usage data

### How GreenCode helps

GreenCode helps tackle this by mining a running estate and rebuilding it as infrastructure as code. It then attributes energy and CO2e to the services that cause it, including services that barely run at all. [More on this](https://greencode.ai/feature/infrastructure-carbon-footprint-assessment/).

### Tags

#iac#cloud

### Sources

- [GreenCode State of the Art Review, D2.1 (2025), PDF p. 72: Infrastructure as Code makes infrastructure reproducible, versioned and consistently manageable](https://greencode.ai/publications/d2-1-state-of-the-art-review/)
- [Infrastructure carbon footprint assessment](https://greencode.ai/feature/infrastructure-carbon-footprint-assessment/)
- [Checkov, YAML custom policies: allowed instance types and required tags](https://www.checkov.io/3.Custom%20Policies/YAML%20Custom%20Policies.html?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode)

[All GreenCode Tech Tips](https://greencode.ai/tech-tips/)

#### Key Facts

- Tip **#39**
- For **Ops and infrastructure**
- Category **Cloud and infrastructure**
- Format **short video**
![GreenCode](https://greencode.ai/wp-content/uploads/2024/12/greencode-logo-website-small-colours-2.webp)

Want this checked on your own system? Talk to the GreenCode team.

[Get in touch](https://greencode.ai/contact/)
