In this article we will discuss “infrastructure as code” and why it is so popular. At first let’s try to understand what is infrastructure as code briefly.
What is infrastructure as code?
This is basically file format of your infrastructure. By the word “infrastructure” we understand it is something physical. But if we want to have a document or file format of the same infrastructure then we say, “infrastructure as code”. That means, we can describe/document the infrastructure with all its details like name, location, size etc. using code.
Why infrastructure as code is so popular?
Very briefly speaking, the requirement of on-demand infrastructure made “infrastructure as code” very popular. If we have infrastructure in code format, we can provision infrastructure very quickly When there is a demand. The waiting time will be very less.
Not only infra provisioning, if required we can delete/ destroy those infrastructures. That is once we are done with the infra, we can destroy those very quickly and release the space, capacity, and reduce the cost consumption etc.
So bottom line is “requirement of on-demand infrastructure” is fulfilled by “infrastructure as code”.
Advantages of infrastructure as code
Below are few major advantage –
- We can provision infrastructure quickly when we have the requirement. That is on-demand infra provisioning.
- We can destroy the infrastructure (if required) quickly to reduce cost.
- Once we have the code for provisioning infrastructure, we can reuse them multiple times.
Disadvantages of infrastructure as code
There is no such disadvantage. But below point we need to consider –
- We need to give enough time at the beginning while developing the code/script. Once code is developed we need to give enough to test those code/scripts.
Tools used for infrastructure as code
Below are the most popular tools available in the market –
- Terraform – it is one of the most popular tool in the market. It supports almost all could provider.
- Pulumi – This is a great tool in the domain of “infrastructure as code” and competitor of terraform.
- Ansible – This is mainly configuration management tool. But we can use ansible also to write infrastructure code.
If you are new to terraform, then you can get a high level idea about terraform by going through below article.
If you are interested in learning DevOps, please have a look at the below articles, which will help you greatly.
- Kubernetes Series: Part 1 – Introduction to Kubernetes | Background of Kubernetes
- Kubernetes Series: Part 2 – Components of Kubernetes cluster | Kubernetes cluster in detail
- Kubernetes Series: Part 3 – What is Minikube and How to create a Kubernetes cluster (on Linux) using Minikube?
- Introduction to Ansible | High Level Understanding of Ansible
- Basics of automation using Ansible | Automate any task
- Automation of Java installation – using Ansible
- Automation of JBoss EAP installation – using ansible
- Jenkins Pipeline as code – High level information
- Jenkins pipeline script to build Java application and push artifacts into repository
- Jenkins pipeline script to build & deploy application on web server
- What is End-to-End Monitoring of any web application, and Why do we need it?
- What is “Monitoring” in DevOps? Why do we need to Monitor App/DB servers, Transactions etc.?
- DevOps Engineer or Software Developer Engineer which is better for you?- Let’s discuss
- How To Be A Good DevOps Engineer?
- How to do git push, git pull, git add, git commit etc. with Bitbucket