Infrastructure as Code Accelerates Application Deployment

5 min read

By: Steve Strutt

Infrastructure as Code speeds deployment and reduces risk

Who doesn’t value rapidly deploying applications and environments, repeatable and consistent environment builds, and dev and test environments that mirror production?

Treating infrastructure as code (IAC) brings practices that have transformed application development in the last 10 years to infrastructure and services.

Manually building cloud environments quickly becomes time-consuming and error-prone. It also defeats the value that many see in cloud—the ability to build, deploy, and update applications on demand. IAC is an approach to managing infrastructure that reduces costs, speeds delivery, and reduces risk. With IAC, resources and services are created and managed programmatically through APIs rather than via a portal or command line.

Infrastructure as code patterns as reusable building blocks

Importantly, infrastructure as code (IAC) dispenses with the traditional manual processes used by IT ops teams. This is not simply writing ad-hoc scripts; you write code to provision and manage the lifecycle of your cloud from creation to tearing down. IAC describes the full infrastructure and its topology to host an application. It encompasses every step required to take a blank sheet to the full stack needed to run applications. It also defines how to tear it down again. These IAC patterns become reusable building blocks for complex infrastructures.

Infrastructure as code patterns as reusable building blocks

IAC pattern for resilient and scalable website

This code example illustrates the simplicity of IAC. It defines a reusable code block of three web-servers with security groups, a load balancer, and TLS certificate

resource “ibm_compute_vm_instance” “web-system-test” {

count = 2
os_reference_code = “CENTOS_7_64″
count = 3
datacenter = LON05”
flavor = B1_1X2X25
private_security_group_ids = [“${ibm_security_group.sg_private_lamp.id}”]
public_security_group_ids = [“${ibm_security_group.sg_public_lamp.id}”]
}

resource “ibm_lbaas” “lb-web-system-test” {

name = “${var.lb_name}
protocols = [{
frontend_protocol = “HTTPS”
frontend_port = 443
backend_protocol = “HTTP”
backend_port = 80
}
tls_certificate_id = “${ibm_compute_ssl_certificate.lb-web-cert.id}”
}]

}

Resources and services are described in a friendly, easy-to-use, human-readable Domain Specific Language (DSL). This applies whether they are virtual machines, storage volumes, object storage, networks of VPCs, security groups, or load balancers.

The benefits of infrastructure as code

Treating infrastructure as code has many benefits. Handling it the same way that developers treat code and applying DevOps techniques brings mature practices that improve quality and reduce risk. Existing best practices of version control, testing, small deployments, and design patterns apply equally to cloud infrastructure. IAC is also a key enabler of DevOps as dev and test environments can be created and torn down as needed.

The benefits that adopters have found include the following:

  • The same config can be used for dev, test, and production, ensuring consistency and a known working config

  • Apps and environments can be provisioned on demand, reducing costs for dev and test environments which can be spun up as needed

  • It reduces the potential for human error while deploying apps and infrastructure

Terraform on IBM Cloud

The popular open source Terraform provisioning engine is IBM Cloud‘s infrastructure as code (IAC) tool of choice. Launched in 2014, Terraform has changed the way that infrastructure can be deployed and managed. It brings an industry standard approach to building infrastructure without the need for specialist skills.

Start by following the examples in Automating cloud resource provisioning with Terraform. Create your own Terraform configurations on IBM Cloud from the examples and how-to’s, or follow one of the tutorials to build and manage the lifecycle of complex application environments.

Be the first to hear about news, product updates, and innovation from IBM Cloud