Why is Infrastructure as Code essential? Seven reasons

Luiz Oliveira
6 min readAug 11, 2023

--

In this article, we will discuss the seven reasons why you need to know the true value of the Infrastructure as Code (IaC) paradigm. We’ll cover how tools like Docker and Terraform can help solve many challenges inherent in software development.

If you’ve ever worked in a software development industry company, you’re well aware that one of the initial tasks when joining a project involves the age-old duty of setting up the development environment.

What many people fail to realize is that the software development process encompasses many steps beyond code writing. We could mention steps like requirement specification, analysis, data modeling, and test planning. However, in this text, we’ll address one step that needs to be addressed: assembling and configuring the infrastructure.

When setting up a new development environment, what do you do with the command lines you execute? Do you discard them by any chance? If these lines are run in the command prompt and then forgotten, I regret to inform you that something is amiss in your software development process.

This is one of the major mistakes that many professionals and software development companies still make: discarding the knowledge about the process of assembling a system’s infrastructure.

Discarding command lines is like throwing money in the trash

1. Infrastructure is Code as Well

A system only functions if it’s hosted in an environment specially prepared. Even if this system boasts beautifully written lines of code, it will all be in vain if its runtime environment isn’t perfectly compatible.

Throughout the software lifecycle, it’s common for various configuration changes to be needed in the operating system, application servers, and other foundational software components. After these desired effects are achieved, the executed command lines are often forgotten. Even a well-disciplined system administrator might miss some details of the procedures performed during the resolution of a severe issue.

Assuming these command lines are essential for the system’s operation, we should incorporate them into our code versioning systems.

2. Documentation Alone Isn’t the Solution

Instruction manuals alone are not enough

An age-old practice of many information system providers involves creating an installation manual. An installation manual for a small system or a framework might work. However, installation manuals don’t work for systems with extensive and complex architectures.

Throughout my journey, I’ve witnessed the implementation of various ERPs, CRMs, portals, BI solutions, Data Lakes, among other systems with complex architectures. One commonality among them: the installation manual never works on the first try. Software is a living organism, and everything around it is also alive and dynamic, rendering an installation manual outdated the moment it’s published. Moreover, no two environments are ever exactly the same.

3. Automation Is the Solution for Explicit Knowledge

Considering the difficulty of keeping intact and up-to-date knowledge about the necessary steps for configuring an environment, automation emerges as the best solution to make the infrastructure knowledge explicit.

IaC solutions like Docker require command lines to be written in a file, such as a Dockerfile in this case. Unlike an instruction manual that leaves room for human interpretation, a Dockerfile is executed literally by a machine. The fact that this code is automatically run on a common base allows for immediate and accurate feedback on whether the command lines are correct, enabling periodic testing of these procedures and their constant updates.

In addition to command lines, IaC platforms allow valuable information about topology to be explicitly defined, including interdependencies between services, software versions, connectivity matrices, startup commands, component health checks, and many other knowledge artifacts.

Never underestimate the importance and complexity of connections

4. Time and Money Savings

The reuse of infrastructure code lines holds the same value as the reuse of application code lines. Consider the effort required to set up an entire system infrastructure with various components distributed across virtual machines. Now imagine that all of this can be explicitly laid out in a way that can be automatically executed in just a few seconds.

If the previous paragraph sounds promising, consider now that you can reuse command lines executed, tested, and validated by an extensive community of users. In directories like DockerHub, you can find thousands of freely available images. These images are generally associated with programming languages, frameworks, web servers, DBMSs, etc. All the necessary steps for installing and configuring each of these architectural components are included within them.

Therefore, configuring a complex information system architecture with various interconnected services becomes a simple assembly process, aggregating procedures already validated by others, allowing this process to be completed in minutes.

So there’s more time for coffee

5. Standardization from Development Environments to Production Environment

Another common mistake in software development environments is the need for more standardization. Let’s say a company has software developed in a JavaScript stack. Now imagine the production environment running on a Linux RHEL distribution. Also, imagine that the developer team is spread among users of the following operating systems: Ubuntu Linux, MacOS, and Windows. This scenario is more common than you might think.

The lack of standardization leads developers to have imprecise feedback on whether their code will work correctly in the production environment. Remember that software combines code and infrastructure; ensuring the code runs faithfully on equivalent infrastructures is necessary.

An IaC approach combined with container infrastructure provides the necessary solution for this problem. Container infrastructure provides an abstraction layer in which software isn’t run directly on the host machine but rather on a kind of standardized “virtual machine” that is uniform across all environments that share the same image. The container paradigm employs a partial virtualization approach, which is much lighter than full virtualization — a distinction will be explored in a future article.

In addition to standardizing the operating system, container infrastructure also enables the standardization of all other layers, such as libraries, web servers, application servers, database servers, messaging servers, and more.

6. Isolation and Coexistence of Environments

Another highly relevant benefit is sharing the same host system among various applications. The isolation of these services allows them to be executed on the same machine while maintaining their individuality.

Among many advantages, this individuality allows various applications to run different software versions. Each application can run its specific version of Python, Java, PHP, Postgres, Nginx, etc. This isolation greatly facilitates the lives of developers, who can have various pre-configured environments on their machines, properly isolated with their specific versions and executed only when needed.

For the happiness of the programmers

Thinking about data centers, this benefit can be even more significant. Transitioning infrastructure to a container paradigm allows for much higher efficiency in resource utilization, with significantly lower overheads and idleness compared to full virtualization (virtual machines).

7. Scalability and Elasticity

Scalability is another benefit achievable through IaC. Automating the environment configuration process also enables instances of this environment to be created automatically. This automation facilitates the creation of system instances, allowing the replication of the environment in different locations or the distribution of independent instances to different clients.

Another closely related gain is elasticity, which allows the infrastructure to adapt to different demand levels. The ease of creating and discarding instances provided by IaC enables the infrastructure to be constantly adjusted to meet different seasonal demand levels of the environment.

Conclusion

This article doesn’t aim to be an exhaustive list of reasons for adopting IaC; there are many other reasons. The goal here is to raise awareness among readers about the importance and advantage of embracing this paradigm, particularly the priority that should be given to infrastructure knowledge artifacts.

--

--

Luiz Oliveira
Luiz Oliveira

Written by Luiz Oliveira

I am skilled in Computer Science, Linux, and Programming Languages. When I am not coding, you can find me in a sailboat.

Responses (1)