Orchestration tools rely on a core principle of DevOps: Infrastructure as Code. Infrastructure as Code (IaC) is the act of defining infrastructure properties in configuration files. These configuration files are then stored and tracked in version control systems.
Infrastructure configuration used to be performed manually. Individual team members would install operating systems, upgrade dependencies, and configure networks. This process was both time-consuming and error-prone. Over time, configurations across servers would become inconsistent due to human error. This build-up of errors is known as “configuration drift”.
IaC solves this problem by relying on configuration files as the source of truth for infrastructure state. Since configuration files are machine readable, it enables easier automation. It is also simple to roll back changes if needed since these files are stored in version control systems.
IaC/orchestration tools also rely on the idea of immutable infrastructure. Immutable infrastructure means that servers are not changed once they are created. Instead, when infrastructure configurations change, new servers are created and old ones are destroyed. Immutable infrastructure and the use of configuration files guarantees that all servers are created in the same manner and eliminates the risk of configuration drift.
Immutable infrastructure would not have been practical in the age of physical servers, since the cost and time to set up physical servers is high. Operations teams had to rely on updating servers once they were deployed. Virtual machines, however, can be destroyed and created in minutes with little cost. With containers, it might only take seconds.
IaC and immutable infrastructure ultimately lead to lower business costs and a better user experience. These principles demonstrate how DevOps applies development principles to operations.
Take a look at the image to the right, showing a GIF of how IaC tools can create new infrastructure resources. How does this GIF embody the concepts of Infrastructure as Code and immutable infrastructure?
The GIF demonstrates Infrastructure as Code since the desired state of our infrastructure is stored in a machine-readable configuration file. It demonstrates immutable infrastructure since resources are created rather than updated.
In exercises thus far, we’ve learned a lot about techniques for configuring infrastructure. The next two exercises will focus on two strategies for physically managing infrastructure – in-house and cloud-based infrastructure.