Over the past decade, DevOps has gained significant momentum . Since it was introduced in 2007, the methodology has seen its adherents multiply rapidly. According to research from Atlassian, by 2020 around two thirds of companies had adopted some of DevOps practices.

Why do companies love DevOps? The answer is simple: they want to maintain a competitive edge. Shipping cutting-edge software products is only possible if you have proper development operations in place. Startups, in particular, are vulnerable to costly mistakes. 

Infrastructure as Code (IaC) is known as “the king of DevOps practices,” and rightfully so: it’s the backbone of development operations. 

But how does it stand out from other DevOps options?

What are Common DevOps Practices?

Despite common misconceptions, DevOps is not a technology. It’s a combination of development philosophies and tools. As a result, there are various approaches to building a DevOps infrastructure. Companies have different names for their own approach. Amazon, for example, calls them its best practices

The central theme in DevOps is achieving a “frictionless, fluent, and resilient” organizational structure. There are different ways to do this. 

Continuous Integration/Continuous Delivery (CI/CD)

CI/CD pipeline is a framework that provides painless deployments for production when multiple contributors are involved. 

CI merges isolated pieces of code with a shared mainline so that developers always have a ready build. СD automates product releases: software changes are pushed to the staging environment for automated testing. The final changes can then be pushed to production. 

The common options here include Bamboo CI, Jenkins, GitLab CI, Circle CI, Travis CI, and Buddy.  

Infrastructure as Code (IaC)

Infrastructure as Code supplies the development environment via programming means, thereby eliminating manual administration. IaC cuts development costs and improves the adaptivity and availability of the development foundation. 

For a more comprehensive definition of Infrastructure as Code, please refer to the next section. 

Monitoring and Logging

There might be occasions when only monitoring or logging is required. However, these two usually go together. Logging is pretty much what it sounds like: keeping track of the changes and errors in the application, while monitoring serves as a way to send alerts when critical issues are discovered. 

Microservices

The microservices architecture is a framework for building a software application that consists of many autonomous services. There is an application programming interface (API) in place that allows these services to communicate with each other. 

This versatile DevOps approach lets developers scale the infrastructure incrementally. Each independent service serves a specific business purpose. Therefore, adding a new service to cover additional business needs doesn’t require significant modification to the overall codebase. 

What Is Infrastructure as Code? 

Infrastructure as Code is the automation of the infrastructure supply chain via the specification files. It’s faster than a drag-and-drop graphical interface. DevOps developers can configure everything they need using a variety of automation/orchestration tools such as Chef, Puppet, Ansible, and Terraform. In some cases, administrative languages like Python, Perl, and Bash can be used.  

The IaC Benefits

If we were to describe the benefits of  IaC in one word, it would be confidence. Here’s what we mean.

Business Continuance

The deployment process often relies on a single person. When you’re in a situation when this person can’t be reached (if they’re on vacation, for example) that can become a serious problem. 

The good news is that an automated approach can prevent that kind of situation. A consistent deployment process leaves no room for errors or other undesirable obstacles that can result from human involvement. 

Faster Time to Market

Any cloud service is launched with a line of code. Since you won’t need an extra pair of hands to maintain the service, your employees can deal with more pressing matters. Money saved is money earned!

Improved Quality of Software Development

The word “infrastructure” implies the supply of ongoing operations. In our case, it’s the provisioning of software development operations. With multiple staging environments, each department can have its own workspace. For example, a quality assistance (QA) department can use a production duplicate to perform user acceptance testing. 

The final commits can be seamlessly pushed from the different environments without interfering with each other. 

By following the best DevOps practices, your development operations will remain structured and methodical. The table below shows what can change by adopting DevOps practices.

Keeping things as there areAdopting DevOps
Manual configuration of each deploymentReusable configuration setups
Deployment takes timeRapid deployment
Breakdowns are likelyVersion control lets you roll  back if something goes wrong
Requires an extensive amount of documentationInfrastructure code itself is a documentation
Bottlenecks require manual troubleshootingBottlenecks are not significant and can be resolved quickly
Table 1. The advantages of DevOps

The IaC Problems

Infrastructure as Code is not for everyone, and the approach comes with some downsides. 

The Transition Issues

Transitioning to an automated infrastructure can be difficult. Several things can go wrong if manual infrastructure management wasn’t consistent. 

Migrating IaC infrastructure to a different cloud provider

This can be tricky because migration requires rewriting infrastructure code for a new cloud provider and may require adjusting the resources used for the code. 

IaC tools: The Option to Choose

There’s no shortage of IaC tools and there are plenty to choose from. We picked the most popular options below (in no specific order)  (please see Table 1).

TerraformAWS Cloud FormationAzure Resource ManagerGoogle Cloud Deployment Manager
Programming scriptHashiCorp Configuration Language (HCL)YAML, JSONJSONYAML, Python
Multi-Cloud SupportYesNoYesYes
LicenseOpen-sourceFree option availablePaid subscriptionPaid subscription
SupportTerraform support/large user communityAmazon support/large user community30-day support onlyCommunity support
Table 2. Comparison of popular IaC tool

Terraform

Compared to other solutions, Terraform is slightly ahead of the game. The good thing about the solution is that you don’t have to stick with one specific service provider. Terraform allows you to create reproducible infrastructure across multiple environments by inheriting configurations. That’s very much in line with DevOps philosophy. 

Terraform also tends to have slightly better reviews on G2

AWS Cloud Formation

The main drawback of AWS Cloud Formation is its dependency on Amazon. It’s pretty much designed to be used only with this specific provider. On the other hand, the specification files here include support for YAML and JSON. 

Azure Resource Manager (ARM)

Azure Resource Manager offers granular-level user permissions for better access management. It’s also around 10% cheaper than AWS Cloud Formation. However, the solution  comes with limited support options. Other than that, ARM is effectively the same as the other solutions. 

Google Cloud Deployment Manager (CDM)

Unlike the previous solutions, Google Cloud Deployment Manager mostly uses YAML and Python. Google CDM has a number of dedicated cloud services that can be arranged in one unit for your specific project. Additionally, you can preview the impacts of your changes. This feature doesn’t belong exclusively to Google, though. 

IaC Management: How to Guarantee Infrastructure Provisioning

To give you a general idea of how IaC works, here’s a basic overview of the process (please see Figure 1).

How the Infrastructure provisioning works
Figure 1. How the Infrastructure provisioning works
  1. The configuration files and other infrastructure specifications are defined in the required language (depending on the IaC tool).
  2. The specifications are pushed to the Automation API or Server. 
  3. The platform functions according to the defined specifications. 

How to Guarantee Infrastructure Provisioning

There are 4 ways to guarantee infrastructure provisioning: 

  1. Use ad-hoc scripting for simple infrastructure setups. 
  2. For more complex setups, use the power of IaC tools like Terraform or AWS CloudFormation.
  3. To manage IaC, use configuration management tools like Chef, Puppet, or Ansible. 
  4. You’ll also need libraries with pre-established components (like Chef, Ansible, or Puppet). 

Is It Difficult to Get Started?

Not really. It might seem like you’d need complex code to get started. However, the snippet of code below is all you would need to launch a Nginx web server using Terraform.

data "aws_ami" "ubuntu" {
 most_recent = true
 filter {
   name   = "name"
   values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"]
 }
 filter {
   name   = "virtualization-type"
   values = ["hvm"]
 }
 owners = ["099720109477"] # Canonical
}
 
resource "aws_instance" "web" {
 ami           = data.aws_ami.ubuntu.id
 instance_type = "t3.micro"
 tags = {
   Name = "HelloWorld"
 }
}

Although this is only the tip of the iceberg, there is much you should take into account. 

IT Infrastructure Best Practices

In a perfect world, once you set up an automation process, you wouldn’t have to touch it again. Sadly, we don’t live in a perfect world. The invisible forces of entropy keep up with everything, leading any system to inevitable decline. Development infrastructure is no exception to that rule. 

Following best practices can be critical for small companies and startups. On average, about 90% of all startups failAdopting IaC can significantly improve the quality of software development and help put your company among the 10% of startups that succeed.

Change Management

IaC has several practices designed to manage infrastructure changes. The expression “change management” isn’t totally relevant here. The best way to handle changes is to avoid unnecessary ones!

One Step at a Time

Make one small change and then proceed to another one (be sure to test it first!). Your initial impulse might be to do the entire infrastructure adjustment at once, but that approach could lead to negative consequences. Instead, we suggest that you modify the system incrementally. 

Automatically Generate Documentation

The main issue with a standard documentation process is that it quickly becomes outdated. With IaC, required documentation standards are embedded in the code. Use minimum code at the beginning and let it grow naturally. 

Version It

The version control system (VCS) is an integral part of your IT setup. There should always be a corresponding tag and commit for any infrastructure change. 

Consistency

Consistency is the key to sustainability as far as infrastructure supply is concerned. Here are a few critical aspects:

Reproducible and Disposable Elements

Changes are not a bad thing. In fact, infrastructure supply sometimes lacks changes when they are most needed. The lack of changes is often driven by a fear that something could go wrong. However, it should be possible to create, destroy, replace, resize, and move resources with ease.

Uptime

As a part of your robust infrastructure, servers should always be up and running. If one of your servers goes down, the other ones must be ready to fill in instantly.

So What?

All in all, it’s not really about which DevOps option is the best. You can use any of them to achieve your goals. But if you’re just starting out, IaC can be an excellent stepping stone to further DevOps development.