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

# Tech Tip #39: Put your infrastructure in code (video)

## 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)

### Transcript

You cannot cut waste you cannot see. Many estates were built by hand, click by click, in a cloud console. That hides servers that are too big, doubled up or forgotten. Nobody can review what was never written down. So the waste stays, and keeps drawing power. Here is the fix you can use today. Describe your 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. Write it down using tools like Terraform or OpenTofu, and check it with Checkov. Then estimate your cloud's energy and emissions, using tools like Cloud Carbon Footprint. GreenCode helps tackle this by mapping a running estate and rebuilding it as code. Then it shows which services use the energy, and which barely run. That was GreenCode Tech Tip number thirty-nine. Follow for the next tip, and find more on greencode.ai/tech-tips.

[The tip in full](https://greencode.ai/tech-tips/39-put-your-infrastructure-in-code/)

[« Tech Tip #38: Not everything is worth optimising](https://greencode.ai/shorts/38-not-everything-is-worth-optimising/)[Tech Tip #40: Give your AI assistant structure, not raw files »](https://greencode.ai/shorts/40-structured-context-for-ai/)

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

#### Key Facts

- Tip **#39**
- For **Ops and infrastructure**
- Length **1:10**
- Category **Cloud and infrastructure**
![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/)
