Skip to content

What is Infrastructure as Code?


Companies large and small, technical and not-technical, are using infrastructure as code (IaC). We are leaving behind the days when infrastructure configuration was done manually. Code is becoming a more common representation of infrastructure. It could be HCL with Terraform or TypeScript with AWS CDK or Python with Pulumi.

The transition to infrastructure code is rapid and evolving at a rapid pace. It begs the question: Why is infrastructure as code so important? It also raises the question of why a business or product manager should invest their time in creating it. Today we’ll look at the benefits of infrastructure as code.

Importantness of Infrastructure Code

It is a big investment to invest in code practices and solid infrastructure. Each tool has a different learning curve. What are the benefits of investing this time?

Cloud computing has many benefits. You can scale up and down your compute resources instantly. Reduced costs by not having to pay extra for hardware that isn’t needed. Pushing huge security processes to the cloud provider. These are all benefits of cloud computing.

What are the tradeoffs? There are many. Complexity is the most important for infrastructure as code. Complexity is a problem when running production-level workloads on the cloud. This is not a problem if your web application is running on an EC2 instance behind a loadbalancer. It’s a different story if you have a web app, a database and a Kubernetes cluster.

This problem becomes even more severe when you have to manage multiple environments. Consider your development, staging and production environments. All that infrastructure must be provided and maintained. It is difficult and time-consuming to do this manually.

This is why infrastructure code is so important. You can represent the entire infrastructure in one module depending on which tool you use. You can then add another instance to that module with the new environment name when you need another environment. You don’t have to do all that work again to create the module.

Infrastructure as code is also important. Visibility.

Infrastructure as code gives everyone visibility into the current configuration. Why? Because it is represented in code, and committed to a repository of source code. Anyone with access to the source code can view the current configuration. Pull request reviews are used to review any changes made to infrastructure configuration. Pull requests allow everyone to see the changes and why.

There are many reasons IaC is so important. The two most significant reasons IaC is important are improved complexity management and greater visibility into infrastructure configuration.

Engineering teams can benefit from all the reasons infrastructure code is important. A Product Manager may not see these as benefits to the solutions they are trying deliver to their users. This is a classic engineering and product tug-of-war that is normal. Infrastructure as code can make it difficult to see the benefits of investing in time and resources. This is because the end-users of the product are the ones who should be considered, and not the infrastructure.

We must now examine the benefits infrastructure as code could bring to someone working in a product position. These are benefits that can be realized by the entire company.
1. Reduced risk

It is risky to manually provision all infrastructure. This requires manual labor that is susceptible to errors. This task may only be possible with one person. This person could leave the company and take all of that knowledge with them. Both of these risks are minimized by presenting infrastructure as code. We are much less likely to make mistakes if we represent infrastructure as a series of blocks of code. Infrastructure is code that lives in a repository of source code. Everyone on the team can see its history and any changes.
2. For faster iterations, stable and consistent environments are key.

Product development is slowed down when environments must be manually modified or configured. This is particularly true when the product needs to modify its architecture in order to better serve its customers. Infrastructure as code environments can be stable, consistent, and easy to modify. They are code and live alongside the product so that we can both change one. This harmony allows for faster development of new features. This allows for less overhead in managing an environment.
3. Cost optimization

All resources can be represented in code so you can see what’s running and what should not. Product profit margins can be maintained by optimizing costs. Infrastructure as code makes it much easier to optimize these factors.
4. Self-documenting

Software development has a philosophy that good code should be easy to understand. Because it is clear what it does, it doesn’t often need to be commented. It is important that new developers can read the code and understand what is happening. Infrastructure code is self-documenting just like other code. This is a great way to increase the number of people in the team. Self-documenting code can cut down on the time it takes to add a new developer into your team.

Companies large and small can use infrastructure as code to transform their business. It is often described as an engineering benefit. It has many benefits that can be felt throughout the business, from finance to product.

It is not a magic bullet. It takes investment. The benefits of that investment are almost immediately apparent. You will see the benefits in both the engineering and product teams. They can feel the difference in product iterations, reduced risk, lower costs, easier onboarding, and faster product iterations. A better infrastructure process that uses code as code can yield long-term benefits for the company or product.