How can a whole data center be described in a text file?
If servers are set up from a file, hundreds of machines can be built the same way, and a bad change can be reverted.
โถ Start the storyA whole can be described in a text file because the files tell machines exactly how to set themselves up. This is infrastructure as code: managing and provisioning data center resources through machine-readable definition files, instead of by hand. The same code can create one server or hundreds, the same way each time.
Martin Fowler remembers the old way as the Iron Age. To release a new server application you had to find physical hardware, configure it and deploy onto it, and getting the hardware usually took months. Now, in the Cloud Age, firing up a new server is a matter of seconds and needs only an internet connection and a credit card. Software commands create servers, set them up and tear them down.
Speed is not the main point, though. When people build servers by hand, different readings of imprecise instructions, let alone errors, produce snowflakes: servers with subtly different configurations that cause faults that are hard to debug. The rule of infrastructure as code is that nobody logs in to a server and makes adjustments. Every change goes into the code instead.
By hand
- Each server set up a little differently
- Faults are hard to debug
- Few records of what changed
As code
- Every server follows the same file
- Changes are recorded and tested
- Roll back to the last working version
The code is then kept in , so every configuration and every change is recorded for , and it can be tested like any other program. Using configuration code makes changes safer, faults are found and fixed more quickly, and at worst changes can be reverted to the last working configuration. It's the same safety net programmers have for their own code, applied to the machines that run it.
Quiz me
0/3
Recap
Describe the machines in a file, never tweak them by hand, and treat the file like code.
๐ก A trick to remember it ยท No hand-made snowflakes: if the booklet isn't followed, the castle won't match.
Surprising fact ยท A 2020 report found around 200,000 potential vulnerabilities in infrastructure-as-code templates.
Connects to
- ๐ How can a company release new software many times a day?
- โ๏ธ How did an online store become the world's biggest renter of computers?
- ๐๏ธ How do thousands of programmers edit the same code without chaos?
- ๐งฎ Why does Google budget for its own failures?
- ๐ฆ How did a plain steel box change world trade?
Sources (2)
No source, no claim. Every fact in this lesson (15 claims) cites at least one of these.