5 min read

15 years ago, adding an additional server to a project’s infrastructure was a process that could take days, if not weeks. Nowadays, thanks to cloud technology, you can get a new server ready for your project in just a few seconds with a couple of clicks. 

New and better technology doesn’t mean it doesn’t have its own set of problems though. Because it’s very easy to add servers to your project now, your capability to manage your project infrastructure usually doesn’t grow as fast as the size of your infrastructure. This leads to a lot of problems in the backend, such as inconsistent server configurations or configurations that can’t be replicated. It’s a common problem among massive web projects, so various approaches to tackle that problem are being devised. One such approach is known as ‘Infrastructure as Code.’

(image from http://cdn2.itpro.co.uk/sites/itpro/files/server_room.jpg) 

Before we go on talking about Infrastructure as Code, let’s first make sure that we understand the basics, which is infrastructure configuration and automation. Before an infrastructure (or a server) can be used to run a web application, it first has to be configured so that it has all of the requirements needed to run that application. This configuration ranges from very basic, such as operating systems and database types, to user accounts and software runtimes. And when dealing with virtual machines, configuration can even include the amount of RAM, storage space, and processing power a server would have. 

All of those configurations are usually done by typing in the required commands on a terminal connected to the infrastructure. Of course, you can do it all manually, typing commands to install the needed software one by one, but what if you have to do that to tens, if not hundreds, of servers? That’s where infrastructure automation comes in. By saving all of the needed commands to a script file, we can easily repeat this process to other servers that need to be configured by simply running that script. 

All right, now that we have the basics behind us, let’s move on. What does Infrastructure as Code really mean? 

Infrastructure as Code, also known as Programmable Infrastructure, is a process for managing, computing, and networking infrastructure using software development methodologies. These methodologies include version control, testing, continuous integration, and other practices. It’s an approach for handling servers by treating infrastructure as if it were code, hence the name. 

But wait, because infrastructure automation uses script files for configuring servers, isn’t it the same as treating infrastructure as code? Does it mean that Infrastructure as Code is just a cool term for infrastructure automation? Or are they actually different things? 

Well, infrastructure automation is indeed one part of the Infrastructure as Code process, but it’s the other part—the software development practices part—that differentiates the two of them. By employing software project methodologies, Infrastructure as Code can ensure that the automation will work reliably and consistently on every part of your infrastructure. 

For example, by using version control systems on the server configuration script, any changes made to the file will be tracked, so when a problem arises in the server, we can find out exactly which changes caused that problem. Another software development practice that can be applied on infrastructure automation is automated testing. Having this practice would make it safer for developers to add changes to the script because any error added to the project can be detected quickly.

All of these practices help ensure that the script configuration files are correct and reliable, which in turn ensures a robust and consistent infrastructure.

(image from https://assets.pcmag.com/media/images/417346-back-up-your-cloud-how-to-download-all-your-data.jpg?thumb=y) 

There’s also one more thing to consider. Do not confuse Infrastructure as Code (IaC) with Infrastructure as a Service (IaaS). Infrastructure as a Service is a cloud computing service that provides infrastructure to developers and helps them manage it. This service allows developers to easily monitor and configure resources in their infrastructure. Examples for these types of cloud services are Amazon Web Services, Microsoft Azure, and the Google Compute Engine. 

So, if both Infrastructure as Code and Infrastructure as a Service help developers manage their infrastructure, how do they exactly differ? Well, to put it in simple terms, IaaS is a tool (hammer) that gives developers a way to quickly configure their infrastructure, while Infrastructure as Code is a method to utilize such tools (carpentry). Just like how you can do carpentry without a hammer, you’re not restricted to using IaaS if you want to run Infrastructure as Code practices on your infrastructure. 

That said, one of the big requirements of being able to run Infrastructure as Code practices is to run the project on a dynamic infrastructure system. That is, a platform where you can programmatically create, destroy, and manage infrastructure resources on demand. While you can implement this system on your own private infrastructure, most of the IaaS available on the market already has this capability, making itthe perfect platform to run the Infrastructure as Code process. 

That’s the gist of the Infrastructure as Code approach. There are plenty of tools out there that enable you to apply Infrastructure as Code, including Ansible, Puppet, and Chef. Go check them out if you want to try this methodology for yourself. 

About the author

Raka Mahesa is a game developer at Chocoarts, http://chocoarts.com/, who is interested in digital technology in general. Outside of work hours, he likes to work on his own projects, with Corridoom VR being his latest released game. Raka also regularly tweets at @legacy99. 

LEAVE A REPLY

Please enter your comment!
Please enter your name here