What is Infrastructure as Code (IaC)? And why you should do this
Living in a world where we even doesn’t come to know how many times our app has been updated in the background and what crucial changes has been brought to it even without a single interruption while using — sounds like something just happened (whoosh) — Amazing?
If you understood what I just said as an example to make you realize how important Continuous Delivery is in today’s world — and if you seriously cares about maintaining the health of your software in this vast and competitive market — then you are most welcome to Infrastructure as Code (IaC) world :)
So what exactly is Infrastructure as Code (short term IaC)? And how it can really improve the health of engineers and developers so they can continue building and finishing the feature without worrying or caring about all of those underneath infrastructure things?
So sit back and relax we are diving deep into it.
Read with me — Infrastructure, as, Code. As you come to know that IaC is composed of three different words — Infrastructure, as and Code — so now it doesn’t sounds much cooler to you infact it exactly carries the same meaning as the words tell. Before DevOps, teams need to do a lot of manual operations to setup servers, VMs, environments, DBs, installing software/applications, runtime envs, network configurations, protocols, security, maintenance and ton of other manual tasks to provision a infrastructure so they can start deploying and monitoring their software. It eats a lot of time, effort, costing and human-resource. After DevOps, we were introduced to a new completely new concept and i.e. Infrastructure as Code which replaces all of those time and effort taking operations by setting up some automated code configuration files which necessarily takes care of all those things required to provision, maintain and monitor a infrastructure. So, in a nutshell, it means — Automate all tasks end to end.
As a Software Engineer, we need tools. I mean great tools. What I would like to say that — our productivity is directly proportional to systems. Just like systems are designed to perform relevant tasks and operations. In the same manner, we also need to be programmed (say equipped) by some of the best tools that brings the most out of ourselves. But, all of these sounds totally worthless till the time you didn’t know which tool to pick for which problem. That’s crucial. Just like, to perform IaC, there are some widely used tools and programs available in the market which you can pick for IaC.
Now maybe you would be wondering why so many tools? Can we pick one that does everything from zero to hundred. The answer is ‘No’. Every tool performs parts of automation depending on which one is good and in which area (see timeline below).
Timeline 1: Infrastructure provisioning
- Spinning up new servers
- Network configurations
- Creating Load-balancers
- Configuration on infrastructure-level
Timeline 2: Configuration of provisioned infrastructure
- Installing apps and services on servers
- Managing those applications
- Prepare the infrastructure/servers to deploy your app (install Java, DB, etc.)
Timeline 3: Deployment of Application
Using Docker container technology you can merge Timeline 1 & 2 to automatically build a package with all the necessary configuration in a environment and run install Docker runtime so it will automatically deploy all of your services on your servers and that’s it!
Distinction of Phases
Initial setup phase
- Provision infrastructure
- Configure infrastructure
- Initial installation of software
- Initial configuration of software
- Adjustment to infrastructure
- Add or remove servers
- Update/changes software
- Re-configuration of software (all sort of things)
That’s it! Now you are equipped with the foundational knowledge behind IaC you can go ahead kicking-off your own IaC for delivering safer and faster.
Subscribe to my Medium newsletter so you can stick with me as I will be writing more about Infrastructure and CD pipelines things.
Wish you all the Best!