Infrastructure as code (IaC), is being used by companies large and small, technical or non-technical. These days, you no longer need to manually configure your infrastructure. Every day, infrastructure is represented in code. It can be HCL with Terraform, TypeScript and AWS CDK, Python with Pulumi, or HCL with Terraform.
This rapid transition to infrastructure as software is happening at lightning speed and it’s constantly changing. This raises the question of why infrastructure is code so important. However, it begs the question: Why should a business invest in their developer’s time to establish it?
Code of Conduct: The Importance Of Infrastructure
It’s a large investment to invest in solid infrastructure and code practices. Every tool will have a different learning curve. How can a team invest their time wisely?
Cloud computing is well-known for its many benefits. Cloud computing allows you to automatically scale out or in your compute resources. You can save money by no longer having to pay for excess hardware in your closet. Pushing massive security processes towards the underlying cloud provider. All of these are benefits to cloud computing.
But what about the tradeoffs. There are many. Complexity is the one most relevant to infrastructure code. Complexity is required to run production-level workloads in a cloud environment. If you only have one web application running on an EC2 instance behind a Load Balancer, it isn’t a problem. However, it is quite different if you run a web application and a Kubernetes Cluster, a Kubernetes database, and some serverless functions that support all of the services for your application.
The problem gets worse when you have to run multiple environments. You need to think about your development, production, and staging environments. All infrastructure needs to be maintained and provisioned. This is a time and labor intensive task that can be done manually.
This complexity is what makes infrastructure as code so crucial. Depending on the tool you choose, all of that infrastructure can be represented in code as one module. If you wish to create another environment, you can add an instance of the module with your chosen environment name. It is not necessary to repeat the work of creating the module, as DRY for your infrastructure.
However, infrastructure code is essential for another reason. Visibility.
Everyone can see the current configuration with infrastructure as code. Why? Because it’s coded and stored in a source code repository. Anyone can access the code to see the current configuration. Any changes to the infrastructure configuration are subject to a pull request review. Everyone can see and understand what is being changed by pulling requests.
There are many reasons IaC matters. There are many reasons why IaC is so important. The most important ones, however, are better complexity management and improved visibility into infrastructure configuration.
For engineering teams, all of these reasons infrastructure as code are important rings true. However, a Product Manager might not view these as benefits to what they’re trying to deliver, solutions to their users. It’s an example of the old engineering and product tug of warfare that is common. However, infrastructure as code can be difficult to understand if you are only thinking about end-users and not the infrastructure.
Let’s take a look at the benefits of infrastructure as code for product roles. These benefits can be realized across the organization.
1. Risk reduction
It can be risky to provision all of your infrastructure manually. It is tedious and error-prone. It might only require one person to complete. The person could quit the company and all the knowledge they have with them. These risks can be minimized by thinking of infrastructure as code. Representing infrastructure as code blocks that can be reproduced makes it less error-prone. Infrastructure as code lives within a source code repository. Every member of the team can view its history and see any changes.
2. Stable and consistent environments allow for quicker iterations
It slows down product development when environments need to be manually changed or configured. This is especially true when the product wishes to alter its architecture to better meet its users. Code environments, also known as infrastructure, are consistent, stable, and can be easily modified. They live in the code alongside the product. This allows us to make changes to one while also changing the other. This harmony makes it possible to develop new features for the product more quickly. It is easier to manage a specific environment.
3. Cost optimization
You can easily see which resources are running and which ones should be stopped. Cost optimization helps maintain product profit margins. These optimizations are much easier when infrastructure is code.
4. Self-documenting
In software development, there is a belief that good code can be read easily. It doesn’t always need many comments, as it’s obvious what it’s doing. A new developer should be capable of reading the code and understanding the logic. It is self-documenting as any other code. This can make it easier to add people to your product’s team. You can speed up the process of a new coder joining the team by self-documenting it.
For companies small and large, infrastructure code can be a game-changer. Many people refer to the engineering benefits as one of its many benefits. The benefits are felt by all business units, from product development to finance.
It isn’t a panacea. It requires investment. It is worth the investment. The benefits are almost immediate. The engineering team can see immediate benefits such as faster product iterations and lower risk. An investment in infrastructure that is more healthy can have a lasting impact on the company’s product and business life.