FoundationInfrastructure as code

What is infrastructure as code, and why is it better than clicking in a console?

What they are really testing: Whether you can articulate benefits beyond "automation". The answers that separate candidates are reviewability, reproducibility, and drift, which are about the team, not about typing speed.

A real interview question

What is infrastructure as code, and why is it better than clicking in a console?

What most people say

drag me

It automates infrastructure creation so you do not have to click through the console every time.

It stops at speed, which is the least important benefit. Someone with a shell script also has automation. The reasons IaC wins are review, reproducibility and audit, and none of them appear here.

The follow-ups they ask next

  • How do you stop people making manual changes?

    Remove write access in production so the pipeline is the only path, run drift detection on a schedule, and make the paved road faster than the console so the shortcut is not tempting.

  • What is the difference between declarative and imperative here?

    Declarative describes the desired end state and the tool works out the steps, which makes it naturally idempotent. Imperative lists the steps, which is more controllable but harder to re-run safely.

What the interviewer is listening for

  • Names review and reproducibility before speed
  • Mentions drift unprompted
  • Connects it to incident recovery

What sinks the answer

  • Only says "automation"
  • No awareness of drift
  • Cannot explain why declarative helps

If you genuinely do not know

Say this instead of freezing. Reasoning out loud from what you do know beats silence every single time, and a good interviewer is listening for exactly that.

It is [infrastructure described in version-controlled files that a tool reconciles to reality]. It beats clicking because [changes get reviewed like code], [environments are reproducible], and [history is auditable]. The catch is [drift, when people still change things manually].

Keep going with infrastructure as code

All 87 devops engineer questions

Knowing the answer is not the same as recalling it under pressure

Sign in to send the questions you fumble to spaced recall, so they come back right before you would forget them, and learn the concepts behind them with hands-on labs.

Start free