It’s a common problem. You can’t seem to develop and deploy applications fast enough to meet your customers’ changing demands.
However, what if you could automate the processes involved? That could really speed things up. It would also let you scale up or down on the fly, reduce manual errors, improve the availability of the application, and realize the cost benefits of on-demand compute. Sounds great, right? But, how do I accomplish that, you’re probably thinking?
Good news. There’s already an established method for automating your application development and deployment processes – infrastructure as code (IaC). IaC codifies and manages underlying IT infrastructure as software. As TechTarget explains, “The purpose of infrastructure as code is to enable developers or operations teams to automatically manage, monitor, and provision resources, rather than manually configure discrete hardware devices and operating systems.”
Much of the success in automating app development and deployment with IaC is determining the tools to use. As with most situations, your use case will drive your choice of tools. In this post, we present an overview of some tools that fall into the IaC category and describe how we used them for one of our customers.
How IaC Works
The costs and potential for error in application development and deployment often lie in getting the infrastructure ready. That’s because setting up new infrastructure requires stacking physical servers, configuring network cables, and housing hardware in a data center. At least, it used to. Now we can do it all with IaC.
IaC makes it possible to use software to automatically manage and provision the technology stack for an application, rather than manually configuring hardware devices and operating systems. IaC functions much the same way as programming scripts to automate IT processes.
The difference is that scripts primarily automate a series of static steps repeated across multiple servers. IaC employs descriptive language to code versatile, adaptive provisioning and deployment processes.
A Sample of IaC Tools
There are a variety of IaC tools available. Some employ a standard template format, such as YAML and JSON. Others use a domain-specific language (DSL).
Some are for configuration orchestration. They provision the servers, leaving the configuration to other tools. Others handle configuration management and install and manage software on existing servers.
Most configuration management tools can do some level of provisioning, while most orchestration tools can do some configuration management. Depending on the need, some of the tools are a better fit for certain types of tasks.
The following are some of the most popular IaC tools:
- CloudFormation is AWS’s IaC tool and is strictly for AWS Cloud services. It’s a configuration orchestration tool. It uses templates written in JSON or YAML, and its documentation includes numerous examples to help you get started.
- HashiCorp Terraform is an open-source, cloud-agnostic tool designed for configuration orchestration. It uses JSON-like declarative configuration templates that can be version controlled, tested, and executed repeatedly to stand up the infrastructure on multiple deployment tiers. Or, it can rebuild the infrastructure from scratch when needed. Like CloudFormation, it includes a large library of pre-written modules.
- Chef uses Ruby-based DSL and is considered a configuration management tool. It allows you to create “recipes” and “cookbooks,” which specify the steps for configuring your applications and utilities on existing servers. Chef works with many different cloud service providers.
- Puppet also uses Ruby-based DSL. It’s an agent-based software configuration management tool that is able to work with on-premise, cloud, and hybrid environments. You can define the desired end state of your infrastructure by using its declarative statements to manage all the stages of your infrastructure lifecycle. Then Puppet automatically enforces that desired state and fixes any incorrect changes, thus preventing configuration drift.
- RedHat Ansible is an agentless tool that operates over SSH or WinRM. The IaC code is written in YAML. Ansible has modules for building infrastructure in various clouds as well as on-premise.
There are many others as well. And like those listed above, each has its share of advantages and disadvantages.
Real-World Use Case
It’s one thing to talk about IaC. It’s another to put it into action. Here’s an example of how ClearScale used IaC with one of our clients.
The company needed to architect, automate, and deploy multiple environments on AWS for app development, testing, staging, and production. Choosing the right IaC tools was among the many decisions that needed to be made.
Drawing on our understanding of the client’s needs and our expertise in these kinds of projects, we decided to design the infrastructure using Docker containers orchestrated by the AWS-managed Elastic Container Service (Amazon ECS).
With Docker, operating system-level virtualization software for containers, you can create images that have all the application code, libraries, tools, and dependencies already installed and configured. By placing our customer’s primary workloads in Docker containers and running them on Amazon ECS, the customer wouldn’t have to install and run its own container orchestration software. Docker also enables code deployment with standardized continuous integration and delivery (CI/CD) pipelines.
Ansible was selected for automating, installing, and configuring an AWS server instance with Jenkins, an open-source tool for implementing CI/CD. Adding the Jenkins pipeline would help us make the build definitions part of the source code.
For building our AWS IaC, it came down to either AWS CloudFormation or Terraform. We chose Terraform, in part, because it accommodates multi-cloud deployment in a single script and allows for tighter integration with a broad range of services.
This is just one example of our successful IaC projects. Want to learn how we can do the same for you? Contact a ClearScale cloud expert today.