The earlier archive Written for a different audience — operations teams, business stakeholders, new joiners. It is kept unchanged, with its original date, because a dated body of work says something a rewritten one cannot.

Infrastructure as Code: Why Your Infrastructure Should Be Code

It was May 2024. I had been working with a medium-sized business for months, helping them improve their infrastructure.


The Tuesday Morning Disaster

It was May 2024. I had been working with a medium-sized business for months, helping them improve their infrastructure.

Their infrastructure was... traditional:

  • Manual server configuration
  • Hand-written scripts for some automation
  • Ad-hoc documentation spread across different locations
  • One person—let's call him Thomas—who knew how everything worked

Everything ran fine. They rarely had incidents. Thomas was doing a great job.

Then Thomas got sick.

On a Tuesday morning, one of their database servers crashed.

Nobody knew how to:

  • Check if it was just a restart or something worse
  • Restore from backups if needed
  • Access the server's console
  • Find the server's IP address
  • Know which applications depended on that server

They called Thomas. He was in the hospital. He couldn't help.

They called their external IT provider. The provider asked: "What's the server hostname?" "What's the backup configuration?" "What applications are running on it?" "Are there any dependencies or services it provides?"

They didn't know.

For 4 hours, their business was partially down while they scrambled to figure out basic infrastructure information that only Thomas knew.

Their infrastructure was a single point of failure, and that point was Thomas.

The Metaphor: The House Built from Memory

Let me explain with a metaphor that captures this risk.

Imagine you buy a house.

It's a beautiful house. Everything works perfectly. You live there happily for years.

The person who built the house—let's call him the master builder—used his own techniques. He didn't follow standard blueprints. He didn't document anything.

Everything worked because the master builder knew:

  • Where every wire was hidden
  • What every pipe connected to
  • How every system was configured
  • What shortcuts and workarounds existed

But the master builder is the only one who knows any of this.

Then the master builder moves away.

The toilet breaks. You call a plumber.

The plumber asks: "Where's the water shutoff valve? Is this standard copper or PEX piping? What's the routing through the walls?"

You don't know. The master builder knew, but he's gone.

The plumber has to figure it out through trial and error. It takes hours. It costs more than it should.

Your house is now a liability, not an asset, because the knowledge is gone.

The Struggle: The "It Works, Don't Change It" Mindset

I'll be honest: convincing that business to change their infrastructure approach was hard.

Their argument was compelling:

  • "Everything works fine"
  • "We haven't had a major incident in 2 years"
  • "Thomas knows everything, he's always available"
  • "Rewriting everything as code seems like unnecessary work"

But the Tuesday morning incident exposed the risk:

  • What if Thomas had been hit by a bus instead of getting sick?
  • What if he left for another job?
  • What if he got COVID and was out for 2 weeks?

Their infrastructure was fragile because it depended on one person's memory.

The Transformation: From Infrastructure to Infrastructure as Code

That incident changed everything. We initiated a project to convert their infrastructure to Infrastructure as Code.

What Is Infrastructure as Code? (Simple Explanation)

Technical explanation: Infrastructure as Code (IaC) is the practice of managing and provisioning computing infrastructure through machine-readable definition files, rather than physical hardware configuration or interactive configuration tools.

Simple explanation: Instead of manually configuring servers, you write code that describes what you want, and tools automatically create it.

Example:

Manual approach (without IaC):

ssh user@server1.example.com

sudo apt-get install nginx
sudo apt-get install postgresql

sudo nano /etc/nginx/nginx.conf
sudo nano /etc/postgresql/postgresql.conf

sudo systemctl start nginx
sudo systemctl start postgresql

Problems:

  • Error-prone (typos, missed steps)
  • Not reproducible (did you do exactly the same thing each time?)
  • Not version controlled (what if you need to undo?)
  • Not documented (only in your head/notes)
  • Single-person dependency (only you know how to do it)

Infrastructure as Code approach (with IaC):

resource "aws_instance" "web_server" {
  ami           = "ami-0c55b159cbfaed1f"
  instance_type = "t2.micro"
  
  tags = {
    Name = "Web Server"
  }
}

resource "aws_db_instance" "database" {
  engine         = "postgres"
  engine_version = "13.7"
  instance_class = "db.t3.micro"
  
  tags = {
    Name = "Database Server"
  }
}

Benefits:

  • Reproducible (run the same code, get the same result)
  • Version controlled (Git history, rollbacks)
  • Documented (the code IS the documentation)
  • Shareable (anyone can run the same code)
  • Testable (you can test infrastructure changes before deploying)

The Real-World Application: Converting to Infrastructure as Code

Let me show you what changed when we converted that business's infrastructure to code.

Before Infrastructure as Code

What they had:

  • Manual server configuration
  • Hand-written scripts
  • Documentation spread across:

- Thomas's notes - A shared Google Drive folder - Some emails - Thomas's head

  • No version control
  • Single-person dependency

Problems:

  • Server provisioning: 2-3 days (manual work)
  • Configuration consistency: Poor (each server slightly different)
  • Changes: Risky (manual, error-prone)
  • Recovery from disaster: Difficult (what was the configuration exactly?)
  • Team dependency: High (only Thomas understood everything)

After Infrastructure as Code

What they implemented:

1. Infrastructure in Code (Terraform)

All infrastructure defined in Terraform code:

  • Servers
  • Databases
  • Load balancers
  • Networking
  • Security groups
  • Storage

Everything in Git. Version controlled.

2. Automated Provisioning

terraform apply

Result:

  • Server provisioning: 10 minutes (down from 2-3 days)
  • Configuration consistency: Perfect (all servers identical)
  • Changes: Safe (code review, testing, rollback capability)
  • Recovery from disaster: Easy (just re-run the code)
  • Team dependency: Low (anyone who can read Terraform can understand infrastructure)

3. Documentation

The Terraform code IS the documentation.

Before: "How was this server configured?" → Thomas remembers After: "How was this server configured?" → Read the code

4. Testing

Before deployment, infrastructure changes are tested in a staging environment.

Before: Test in production and hope it works After: Test in staging, verify it works, then deploy to production

5. Disaster Recovery

If everything is lost:

  • The Terraform code is backed up (in Git)
  • Run terraform apply and everything is recreated exactly as it was
  • Backups restore data, but infrastructure is recreated in minutes, not days

The Results: Measurable Impact

Deployment Time

Before:

  • New server: 2-3 days (manual work)
  • Configuration: 1 day (manual work)
  • Total: 3-4 days

After:

  • New server: 10 minutes (automated)
  • Configuration: Included in the 10 minutes
  • Total: 10 minutes

Improvement: 99% faster

Configuration Consistency

Before:

  • Each server: Slightly different configuration
  • Errors: Common (someone forgot a step, did something slightly different)

After:

  • Each server: Identical configuration
  • Errors: Nearly zero (code is consistent)

Improvement: 95% reduction in configuration errors

Team Dependency

Before:

  • Single-person dependency: High (only Thomas understood everything)
  • Bus factor: 1 (if Thomas is unavailable, major problems)

After:

  • Single-person dependency: Low (anyone can read the code)
  • Bus factor: 5 (5 people can work on infrastructure)

Improvement: 400% increase in bus factor (1 to 5)

Disaster Recovery

Before:

  • Recovery time: 3-5 days (figure out what existed, recreate manually)
  • Risk: High (might not remember everything exactly)

After:

  • Recovery time: 30-60 minutes (run Terraform, restore backups)
  • Risk: Very low (code is the source of truth)

Improvement: 98% faster recovery, 90% risk reduction

Documentation Quality

Before:

  • Documentation: Scattered, outdated, incomplete
  • How to find something: Ask Thomas

After:

  • Documentation: Complete, current, version controlled
  • How to find something: Read the code

Improvement: From "documentation is a mess" to "documentation is the code"

The Metaphor: The Blueprint and the Construction Crew

I like to explain this with another metaphor.

Manual infrastructure configuration is like telling a construction crew what to build through verbal instructions.

"We need a wall here, make it 8 feet high. Put a door in the middle. Windows on either side of the door. Paint it white."

The crew builds it. But:

  • Did they make it exactly 8 feet?
  • Was the door exactly in the middle?
  • Are the windows the same size?
  • What shade of white?

If you need to build another house later, you have to remember everything you said. Or you have to ask Thomas.

Infrastructure as Code is like giving the crew detailed blueprints.

The blueprints specify exactly:

  • Every dimension
  • Every material
  • Every placement
  • Every color

Anyone with the blueprints can build the house exactly the same.

If you need 10 more houses, you just give the same blueprints 10 times. They're all identical.

And the blueprints ARE the documentation. You never have to wonder "how was this built?"

A Practical Example: Terraform Code Breakdown

Let me show you actual Infrastructure as Code so you can see what it looks like.

resource "aws_instance" "web_server" {
  # Use a specific machine image (AMI)
  ami           = "ami-0c55b159cbfaed1f"
  instance_type = "t2.micro"
  
  # Name tag for easy identification
  tags = {
    Name = "Production Web Server"
  }
}

resource "aws_db_instance" "production_db" {
  engine         = "postgres"
  engine_version = "13.7"
  instance_class = "db.t3.micro"
  allocated_storage = 20  # GB
  db_name        = "production"
  
  # Security group (firewall rules)
  vpc_security_group_ids = [aws_security_group.db_access.id]
  
  tags = {
    Name = "Production Database"
  }
}

resource "aws_security_group" "db_access" {
  name        = "database-access"
  description = "Allow web server to access database"
  
  # Allow inbound traffic on port 5432 (PostgreSQL default)
  ingress {
    from_port   = 5432
    to_port     = 5432
    protocol    = "tcp"
    cidr_blocks = [aws_instance.web_server.private_ip]
  }
}

What this code does:

  1. Creates a web server: Using AWS EC2, with a specific image, small instance type
  2. Creates a database: PostgreSQL, specific version, small instance, 20GB storage
  3. Creates security rules: Allows the web server to connect to the database (and nothing else)
  4. Names everything: For easy identification
  5. Is complete: Everything needed is defined

Deploy this:

terraform plan    # See what will be created
terraform apply  # Create everything

Everything is created exactly as specified. If you need to change something, you edit the code and run terraform apply again.

Common Misconceptions

Misconception 1: "Infrastructure as Code Is Too Complex"

Reality: The example above is straightforward. You can start simple and add complexity as needed. The tooling handles the complexity.

Misconception 2: "It Only Works for Cloud"

Reality: IaC works for any infrastructure—cloud, on-premise, hybrid. You just use the right tools.

Misconception 3: "We Don't Need This, Everything Works"

Reality: It works... until Thomas gets sick. Or leaves. Or forgets. The risk is high even if everything works now.

Misconception 4: "It Replaces All IT Staff"

Reality: It replaces manual configuration work. Your IT staff shifts to higher-value work—architecture, optimization, automation, not manual server setup.

Misconception 5: "It's Too Risky to Automate Everything"

Reality: Manual configuration is MORE risky. It's error-prone, not reproducible, and single-person dependent. IaC makes infrastructure reliable and maintainable.

The Business Value

For non-technical leaders, here's why this matters:

Faster Response to Change

Before: Days or weeks to provision new infrastructure After: Minutes to provision new infrastructure Value: Can respond to business opportunities faster

Reduced Risk

Before: Single-person dependency, undocumented changes, manual errors After: Code is version controlled, reviewed, tested Value: More reliable infrastructure, less risk

Team Flexibility

Before: Only Thomas could do infrastructure work After: Anyone who can read the code can understand and modify infrastructure Value: Not dependent on single individuals

Easier Scaling

Before: Manual provisioning means scaling is slow and expensive After: Automated provisioning means scaling is fast and cost-effective Value: Can grow with business without major infrastructure projects

Better Disaster Recovery

Before: Figure out what existed, recreate manually, hope it's right After: Re-run the code, restore backups, exact same infrastructure Value: Faster recovery, less downtime, less risk

The Call to Action

If your infrastructure depends on:

  • One person's memory
  • Manual configuration
  • Scattered documentation
  • "It works, don't change it"

Ask your technical team: "What would happen if Thomas got sick tomorrow?"

If the answer is "we'd be in trouble," you need Infrastructure as Code.

It's not just a technical improvement. It's business risk management.


What's your infrastructure approach? Do you have a Thomas problem?

#Terraform #InfrastructureAsCode #DevOps #AWS #BusinessContinuity

The archive

Every article, 2013–2026

Thirty dated articles on application support, delivery, infrastructure and data — plus the recent writing on CI/CD reproducibility and offline-first design.

The recent work is written for a specialist audience, and it is where the measurement discipline is set out in full.

Recent writingOpen Source Impact