Infrastructure as code (IaC) is being used in companies small and large, technical and non-technical. The days of configuring your infrastructure by hand are moving behind us. More and more infrastructure is being represented as code. Whether it is HCL with Terraform, TypeScript with AWS CDK, or Python with Pulumi.
This transition to infrastructure as code is fast-paced and changing at a rapid clip. So it begs the question, why is infrastructure as code becoming so important? But also, why should a business or a product manager invest their developer’s time in establishing it?
Why is Infrastructure as Code important?
Investing in solid infrastructure as code practices is no small investment. It has its own learning curve and the steepness of the curve varies across different IaC tools. So if a team is going to invest this time, what are the benefits?
The benefits of cloud computing are well known at this point. The ability to scale out and in your compute resources automatically. Cost savings from no longer needing to pay for the overprovisioned hardware running in your closet. Pushing massive security processes to the underlying cloud provider. All these things are benefits of cloud computing
But what are the tradeoffs? There are many. The one that is most relevant to infrastructure as code is complexity. Running production-level workloads in the cloud is complex. It’s not a problem if you are running a single web application on an EC2 instance behind a load balancer. But it’s quite a bit different when you are running a web application, a database, a Kubernetes cluster, and some serverless functions to support all the services of your application.
That problem is only exacerbated when you need to run many environments. Think about your development, staging, and production environments. You have to provision and maintain all that infrastructure. Doing that manually is a massive burden and time commitment.
This complexity is why infrastructure as code is critical. Depending on your chosen tool you can represent all that infrastructure as a single module in code. Then when you want another environment you add another instance of that module with your new environment name. All that work to create the module never has to be repeated again, like DRY for your infrastructure.
But infrastructure as code is important for another reason. Visibility.
With infrastructure as code, everyone has visibility into what the current configuration is. Why? Because it’s represented in code and committed to a source code repository. Anyone who has access to the code can see what the current configuration is. Changes to the infrastructure configuration go through a pull request review. With pull requests, everyone can see what is changing and why.
There is a large list of reasons why IaC is important. But the two most important that make huge differences from day one are better complexity management and increased visibility into infrastructure configuration.
What are the benefits of infrastructure as code for a business?
All those reasons infrastructure as code is important ring true for engineering teams. But a Product Manager might not see those as benefits to what they are trying to deliver, solutions for their users. It’s a bit of the classic engineering and product tug of war that is natural. But with infrastructure as code, the benefits of investing that time and resources can seem opaque to someone who is always thinking about the end-users of the product, not the underlying infrastructure.
So we must take a look at what the benefits of infrastructure as code would be for someone in a product role. More generally, these are benefits the entire organization can realize.
1. Decreased risk
Provisioning all your infrastructure by hand is risky. It requires manual work that is error-prone. It may require a single person to do. That person could leave the company, taking all that knowledge with them. Infrastructure as code minimizes both of these risks. By representing infrastructure as reproducible blocks of code we are far less error-prone. Infrastructure as code lives in a source code repository. Its history and changes are visible to everyone on the team.
2. Stable & consistent environments for faster iterations
When environments have to be manually configured or modified it slows down product development. This is especially true if the product wants to change its architecture to better serve its users. With infrastructure as code environments are stable, consistent, and easily modifiable. They live in code alongside the product, so when we want to change one we can change the other at the same time. This harmony means that new features can be developed for the product faster. There is less overhead to managing a given environment.
3. Cost optimization
When all resources are represented in code you can see what is running and what shouldn’t be. Optimizing cost maintains product profit margins. Those optimizations become much easier with infrastructure as code.
There is a philosophy in software development that says good code is easy to read. It often doesn’t need extensive comments because it’s clear what it’s doing. The idea is that a new developer should be able to come in, read the code, and understand the logic that is happening. With infrastructure as code, it is self-documenting like any other code. This can benefit the product by making it easier to add more people to the team. With self-documenting code, you can reduce the time it takes for a new developer to onboard into the team.
Infrastructure as code is a game-changer for companies large and small. The benefits of it are often expressed as engineering benefits. But the benefits of it are felt across the entire business from product to finance.
It’s not a silver bullet. It requires investment. But when that investment is made the benefits are almost immediate. Faster product iterations, decreased risk, optimized costs, and simpler onboarding are all benefits that can be felt in the engineering team, but also within the product team. An investment into a healthier infrastructure process using infrastructure as code can pay dividends for the entire life of the product or company.