What is Infrastructure as Code?
The future of IT Infrastructure
From large computers that occupied a room to hand-held computers. From programs that took a week to execute to programs that execute in under a second. From servers to serverless. The IT infrastructure has undergone major changes over the years.
The IT Infrastructure, which comprises of routers, servers, computers, data, etc is evolving and will continue to do so. So, this naturally brings us to the question — What’s next? What is the future of the IT infrastructure?
Some of the greatest changes come from pain
To be honest, in the current IT infrastructure, dealing with hardware is quite painful. For example —
If a server is not working properly, then a person from the IT team must fix it. Although the IT team is well-trained, it is hard for them to pinpoint the exact error and fix it.
It has been observed that human error is the major factor of hardware failure. It is highly likely that in fixing one component, you might end up breaking another one. It happens all the time.
Trying to fix a broken server is a painful and costly affair. A well thought out solution would be to completely replace the broken server with a new one, but replacing physical systems with new ones is costly and time-consuming.
Infrastructure is not limited to servers. There are other hardware systems and they disrupt all the time.
If you are running a business that is dependent on routers, servers, etc. Infrastructure issues can ruin the user experience, frustrate your IT/SDE team and impose additional costs. So, it’s important to find a solution or create one.
Infra as code: A Solution?
Infrastructure as code (IaC) is the process of managing and provisioning computer data centers through machine-readable definition files, rather than physical hardware configuration. The IT infrastructure managed by this process comprises both physical equipment, such as bare-metal servers, as well as virtual machines, and associated configuration resources. The definitions may be in a version control system.
In simpler terms, infra as code is literally what it says, i.e, converting Infrastructure to code (a program aka definition file).
With Infra as code, you are no longer dealing with physical infrastructure directly instead you are working with the software interface, which handles the hardware. Think of a mobile phone, it is a hardware device but we use the software interface to interact (text, call, etc) with it.
Instead of dealing with physical hardware configurations, you only have to write a code (machine-readable) that would fix the issues.
Infra as code proposes to :
- Build infrastructure state(create a file that will contain the configurations and parameters of a hardware system)
- Manage and Monitor the systems
- Change it when necessary (in regards to errors)
- Version it (Well, with versioning your infrastructure states, you can go back to an older version if you wanted to)
Infra as code(IaC) is useful:
Because scripting reduces human error. This leads to significantly lower costs, faster and efficient systems. Infra as code is not only limited to monitoring devices but it can also compute, cache, backup, provide security, deliver content, etc.
It also handles the creation of environment for programs. This means it would become easier to develop, test and deploy applications.
How IaC Works?
There are two approaches to implement IaC :
- Declarative approach — In this, the focus is on the end goal i.e the final desired infrastructure state. The system will take care of the process for you.
- Imperative approach — In this, the focus is on the process or steps required to accomplish the end goal.
How Versioning fits into it :
Using any one of the approaches, scripts are written which are then pushed or pulled to a version control system like Git.
- The Push method pushes or sends the desired state onto a system
- The Pull method retrieves the existing configuration
The most important part: THE TOOLS
The tools are responsible for connecting the software (scripts) with the hardware.
Major IT Companies like Google, Amazon, HashiCorp, Red Hat, etc have already created languages (tools) for implementing IaC. Most of these tools are open-source which means anybody can use them for free. Isn’t that wonderful?
Some notable IaC tools :
- Terraform is an open-source IaC tool developed by HashiCorp. It uses the declarative approach in defining and provisioning data centres.
- Ansible is an open-source IaC tool developed by Red Hat. It uses the declarative approach in defining and provisioning data centres, configuration management, and application deployment.
- Salt is python based tool developed by SaltStack, that uses both the declarative and imperative approaches for event-driven IT automation, remote task execution, network deployment, and configuration management.
- Puppet is a software configuration management tool developed by Puppet which includes its own declarative language to describe system configuration. It is a model-driven solution that requires limited programming knowledge to use.
This brings us to the end of this story. The future of IT infrastructure is Infra as code which will greatly help in reducing the complexity of the physical systems by converting them to manageable software systems.
© Shreya Sinha 2021
Written by Shreya Sinha, Thank you for reading.