Infrastructures are hugely complex, and cloud-native infrastructure is even more so.
Often, infrastructures are initially created as a series of one-off decisions. Each component added to the system is different from the component next to it. One server is different from the next. One network switch is different from the next. As the application grows, so does the number of one-off decisions that make up the application’s infrastructure.
This leads to a highly complex infrastructure architecture that is hard to manage. This complexity means fragility in the infrastructure. Seemingly minor problems can end up becoming significant issues. A lack of shared understanding by those involved in maintaining the infrastructure means simple changes end up causing mistakes that lead to errors, bottlenecks and, ultimately, outages.
Even when there is the possibility of reusability of components—such as a series of servers working in a single fleet to operate an application or service—there are often individual differences that are created between each server, making each of them unique. Sometimes these changes are minimal. Sometimes they are nearly invisible. But sometimes, they are critical to keeping the server operational.
These subtle differences mean that if you need to replace a component, recreating that component and its configuration can be difficult.
The Role of Infrastructure-as-Code
Infrastructure-as-code (IaC) simplifies this problem because it encourages reuse and reusable patterns.
With IaC, for example, you can repeatedly use a single server template for each server in a fleet. All your servers used for a particular purpose are set up and configured identically.
Additionally, IaC can improve system documentation. In a traditional infrastructure, the one-off changes made to components are not often adequately documented. In an IaC environment, changes are made to a shared code-like description of the infrastructure, which also becomes a form of de facto documentation.
IaC allows changes made to the infrastructure descriptions to be reviewed and examined by peers. The ability to peer review infrastructure changes before implementation means that different sets of eyes can spot problems. However, they can also spot opportunities for reuse and sharing of common infrastructure solutions, leading to a simpler infrastructure architecture. The changes applied to one place in the infrastructure can be much more easily applied to other, similar spots in the infrastructure.
Using infrastructure-as-code, an application’s infrastructure can be managed just like the application’s software, using all the same software management tools and processes.
When the infrastructure configuration is finally deployed, the physical infrastructure is updated to match the documentation and the entire physical infrastructure becomes self-consistent and self-documented.
Reducing Infrastructure Complexity
IaC can reduce errors and problems, but can it reduce infrastructure complexity? Here are four ways IaC can reduce an infrastructure’s complexity:
- Reuse. Taking a server configuration, for example, and reusing it as the basis for other servers in the same or similar fleets reduces the number of unique moving parts within the infrastructure, reducing overall infrastructure complexity.
- Modularization. Taking a large, complex infrastructure configuration and splitting it into separate functional modules allows a complex system to be examined and tested one component at a time, making understanding and trusting the whole system a lot easier.
- Loose coupling. Loose coupling between modules reduces the dependencies between modules. If a change is needed to one module, there is a chance that change may impact connected modules. The more loosely coupled the modules are, the less likely a change in one affects another. Reducing change-related chain reactions such as this reduces overall complexity.
- Standardization. Using standard, best practice-based infrastructure designs consistently throughout a system reduces the variations and differences from one part of the infrastructure to another, reducing the overall complexity.
These techniques are commonly known and used by software developers to reduce software complexity. But by using IaC to manage their infrastructure, infrastructure designers can use these same techniques to reduce their overall system complexity.
Best practices for managing software changes apply to infrastructure changes driven by IaC. Automated IaC-based deployments can facilitate infrastructure rollbacks when problems occur, allowing a mistaken configuration change to be quickly fixed. When problems do occur, change tracking can be used to detect when issues were first introduced, allowing for a more straightforward root cause analysis.
The overall result? Greatly simplified infrastructure management. This means reduced complexity and hence reduced fragility in the application infrastructure itself.