Book review: Infrastructure as Code by Kief Morris

A comprehensive and well-written guide to preparing infrastructure for the cloud age

There will be, no doubt, some among this book's intended readership of infrastructure engineers and sysadmins who will question the publisher's choice of a vulture to grace its cover.

After all, many server room staff are barely clinging onto their jobs following waves of outsourcing, offshoring and cloud, their pivotal role as "the guys who know how it all works" steadily eroded by the winds of change, and with countless colleagues already having fallen by the wayside.

But don't worry, whatever the reasoning behind publisher O'Reilly's questionable artistic choices, author Kief Morris (currently cloud practice lead at ThoughtWorks) is in the business of helping Ops guys to adapt and survive as the world moves from "the iron age to the cloud age", so they can avoid joining the heaps of bleached bones that line the road to operational efficiency.

People who work directly with technology are accustomed to change of course, that's what they're all about, but the pace of that change can sometimes outstrip their ability to adapt. Things are certainly moving fast in the increasing number of companies that develop their own software, where agile methodologies including DevOps are growing in popularity with knock-on effects down the stack. Agile development focuses on breaking down projects into bite-sized chunks, implementing them, testing and making tweaks based on rapid feedback cycles.

For a look at the current state of DevOps download the Computing DevOps Review 2016

Taking a cue from this methodology, infrastructure as code describes the practice of automating the provisioning and management of infrastructure by ensuring consistency and repeatability of hardware, platforms and processes. With the fundamentals in place, configuration files can be rolled out across the entire estate via well-thought-out routines rather than tailoring them to fit.

While this may be more straightforward in a cloud environment there is no reason why it cannot be applied to in-house servers, networks and storage so long as that infrastructure is made "dynamic" so that scripts and tools can be used to create and destroy (virtualised) infrastructure automatically, report on their status and manage the metadata.

Borrowed directly from software engineering, the basic principles of infrastructure as code are as follows:

By applying these fundamentals to various aspects of infrastructure management the goal is to create platforms that are flexible, adaptable, scalable and anti-fragile - i.e. the more they are stressed the more robust they become.

Book review: Infrastructure as Code by Kief Morris

A comprehensive and well-written guide to preparing infrastructure for the cloud age

The book walks us through key topics in a logical order. So we start with the tools for defining infrastructure and configuring servers and then move on to how they are applied. This is a fast-moving sphere and sensibly Morris does not attempt to cover the myriad tools that are available for configuration management, infrastructure definition and automation, reasoning that the list would be as long as your arm and out of date before the book was published. He does, however, provide snippets of code from the more popular configuration tools Puppet, Chef and Ansible to illustrate his points.

Subsequent sections deal with patterns for provisioning, managing and updating servers, security, testing changes and introducing change management pipelines for infrastructure. While the book is technical by nature and goes into some detail about the practicalities of implementing and managing dynamic infrastructure as code, by returning again and again to the core principles it remains well within reach of CIOs and IT managers and others who might not be habitually hands-on with hardware or code but who nevertheless need to have a handle on the concepts.

The final chapter deals with organisational aspects, exploring how to create a team that is able to react quickly and flexibly while maintaining an ethos of continuous improvement.

Morris's writing is clear and methodical and the real-world examples given (the author has been running automated server infrastructure for 20 years) are illustrative if sometimes a little prosaic. So despite its comprehensive coverage of what is really a rather specialised area, it never feels "heavy" or arcane. It is strongly focused on the server, however, so those looking for more detail about storage and network automation might need to look elsewhere.

One minor gripe is that the monochrome illustrations feel a little cramped and are not particularly clear. We sometimes found ourselves referring to the text in order to decipher the diagrams, rather than the other way around.

A running theme of the book is that pesky humans can easily mess things up by performing one-of-a-kind actions - tweaking an individual configuration file, perhaps, or creating a "snowflake" server to perform a specific task. This creates poor quality systems that are complex and difficult to change. Morris suggests that admins need to learn to trust their automation tools and set up systems that can run in the absence of any human intervention, something that may be anathema to those with a natural urge to tinker.

The old trope that with less time spent "firefighting" there will be more opportunity for innovation is rolled out as an argument for abstracting hardware, as it is for almost every change, but whether Ops folk believe that or not, they will surely see that automation is the way things are going and be mindful of the vultures circling overhead.

Infrastructure as Code; Morris, K.; O'Reilly Media; July 2016; 358 pp; ISBN 978-1-49192435-8; suggested UK price £32.00.