Infrastructure as Code (IAC)

IAC = Manage infrastructure with software techniques

Marker of IAC

How much effort would it take to deploy a copy of the system that was running in production 2 years ago into a test environment?

Goal of IAC

Push a button.

Strategy: Immutable Infrastructure

“The server is created from scratch for every change.”

Features/Components:

  1. Declarative Definition. Say what your system is, not how to build it.

  2. Audit trail of infrastructure.

  3. Simple and consistent scaling.

  4. Eliminates manual execution errors, more generally configuration drift.

  5. TESTABLE.

Warning:

Can be slow(er) to provision. Employ modern tooling, e.g. caching and incremental building.

Principles

  1. Systems can be easily reproduced.

  2. Systems are disposable

  3. Systems are consistent

  4. Processes are repeatable

  5. Systems are always changing.

Practices

  1. Define your infrastructure in files (“soft infrastructure”).

  2. Treat server as cattle rather than pets

  3. Make infrastructure “self-documenting”. The system builds the docs.

  4. Version-control everything. Your infrastructure are defined in files.

  5. Continuously test systems & processes.

  6. Make changes in small steps.

  7. Keep services continuously available.

  8. Prefer unattended execution over interactive use. Put a VCS between people and system.

Acknowledgements

Copied from Farley’s “What Is Infrastructure As Code?” video.