A couple of weeks ago, I wrote a post about DevOps and why all industries need to implement it. But implementing DevOps is not as simple as combining your Development and Operations teams. Any organization that wants the full benefits of DevOps also has to automate things as much as possible: testing, compiling, deployment, even creation of your servers.
That's why — if you're considering DevOps — you have to learn about Infrastructure as Code (IaC).
What is Infrastructure As Code?
Infrastructure as Code, also called Programmable Infrastructure, is an approach to defining your computing infrastructure through source code. In other words, engineers use software commands to create, define, and dismantle virtual machines, networks, or data storage that function as any software system would. Then they thoroughly test that code and save it, so it can be used again and again.
This represents a departure from the old days, when a new physical server would be built on premises by engineers and configured according to instructions in a Word document or wiki page. It's also a change from more recent history, when developers would have to request a virtual machine from IT, a process which might — depending on the company — take days to weeks, and result in a consistently configured server.
The old way of doing things, photo by Juan Manuel Caicedo Carvajal on Flickr (CC BY-SA 2.0)
Infrastructure as Code is important to DevOps because it helps with automation: it allows engineers to easily create virtual machines that are exactly the same. Once a virtual machine is coded into existence and configured, that code is saved. Engineers and developers can then use it to create as many as they need, all configured in the same way.
This repeatability is helpful for a lot of reasons. There's no need to involve a separate department, or request a virtual machine from IT, for example — developers can do it by themselves.
The consistent code also means all deployments are starting from the same infrastructure. It also helps developers scale projects. Martin Fowler writes that Infrastructure as Code is necessary when teams are working with large clusters of servers; the repeatability of the source code helps developers and engineers not only configure those servers consistently, but also specify how they should interact.
IaC is more than infrastructure; it's also a roadmap
For the non-technical, IaC might sound like a lot: you're basically coding virtual machines out of thin Cloud, right? That's not precisely it; often engineers are creating virtual machines using cloud providers like — for example — Amazon Web Services or Azure, so essentially the virtual machines are made out of code, Cloud, and money. The more computing power a virtual machine has, and the longer it's running, the more expensive it is.
Part of the beauty of Infrastructure as Code is that engineers can spin up new machines when they start work for the day, and destroy the ones they don't need when they stop working for the day. That way an organization is only paying for the computing power it needs.
...Unless someone forgets to turn their virtual machine off over the weekend.
There's a benefit there, too, although it might not seem like one when the AWS bill comes that month. Infrastructure as Code is self-documenting; the scripts leave an audit trail that will help a manager figure out whose machine was left on.
Those scripts offer other benefits as well. As Chris Riley, a writer at DevOps.com, points out, scripts serve as documentation, reading like a network diagram from your infrastructure.
In other words, IaC isn't just the roads, it's also the map.
DevOps and IaC go together like peanut butter and jelly
In case you're wondering, you can implement DevOps without Infrastructure as Code, but automation is one of the pillars of DevOps.
If you're undertaking the culture shift associated with DevOps — something that poses a challenge for organizations that have traditionally siloed their teams — you should be prepared to get the most out of it.
Infrastructure as Code will help you do that by making as automation easy as writing code.
Still need some help? Omni can walk you through the process of moving to DevOps, and help you get started with IaC. Contact us to work with us today.