DEV Community

Samuel Udeh
Samuel Udeh

Posted on

What is Infrastructure as Code (IaC) and Why It's Transforming DevOps

Infrastructure as Code (IaC) is a modern approach to managing and provisioning computing infrastructure through code and automation tools rather than manual processes. This practice enables developers and operations teams to define infrastructure in a descriptive manner, making it easy to deploy and manage.

The idea behind infrastructure as code (IaC) is that you write and execute code to define, deploy, update, and destroy your infrastructure.

WHY IT IS TRANSFORMING DevOpS

. According to the 2016 State of DevOps Report, organizations that use DevOps practices, such as IaC, deploy 200 times more frequently, recover from failures 24 times faster, and have lead times that are 2,555 times lower.
When your infrastructure is defined as code, you are able to use a wide variety of software engineering practices to dramatically improve your software delivery process, including the following:

  1. Self-service

Most teams that deploy code manually have a small number of sysadmins (often,
just one) who are the only ones who know all the magic incantations to make the
deployment work and are the only ones with access to production. This becomes
a major bottleneck as the company grows. If your infrastructure is defined in
code, the entire deployment process can be automated, and developers can kick
off their own deployments whenever necessary.

  1. Speed and safety

If the deployment process is automated, it will be significantly faster, since a computer can carry out the deployment steps far faster than a person, and safer, given that an automated process will be more consistent, more repeatable, and not prone to manual error.

  1. Documentation

If the state of your infrastructure is locked away in a single sysadmin’s head, and that sysadmin goes on vacation or leaves the company or gets hit by a bus, you may suddenly realize you can no longer manage your own infrastructure. On the other hand, if your infrastructure is defined as code, then the state of your infrastructure is in source files that anyone can read. In other words, IaC acts as documentation, allowing everyone in the organization to understand how things work, even if the sysadmin goes on vacation.

  1. Version control

You can store your IaC source files in version control, which means that the entire history of your infrastructure is now captured in the commit log. This becomes a powerful tool for debugging issues, because any time a problem pops up, your first step will be to check the commit log and find out what changed in your infrastructure, and your second step might be to resolve the problem by simply reverting back to a previous, known-good version of your IaC code.

  1. Validation

If the state of your infrastructure is defined in code, for every single change, you can perform a code review, run a suite of automated tests, and pass the code through static analysis tools—all practices that are known to significantly reduce the chance of defects.

  1. Reuse

You can package your infrastructure into reusable modules so that instead of doing every deployment for every product in every environment from scratch, you can build on top of known, documented, battle-tested pieces.

  1. Happiness

There is one other very important, and often overlooked, reason for why you should use IaC: happiness. Deploying code and managing infrastructure manually is repetitive and tedious. Developers and sysadmins resent this type of work, since it involves no creativity, no challenge, and no recognition. You could deploy code perfectly for months, and no one will take notice—until that one day when you mess it up. That creates a stressful and unpleasant environment.
IaC offers a better alternative that allows computers to do what they do best(automation) and developers to do what they do best (coding).

Top comments (0)