October 02, 2018
Why Your Organization Should Automate with Infrastructure as Code
Data center provisioning can be a simpler and easier process with this automation process.
How much time do you spend building servers, configuring the settings and installing software? In my experience, a typical server can take anywhere from four to eight hours before it is ready for production. And it can take even longer to wait for numerous approvals and even purchase requests.
Once it is built, how do you know that it is configured the correct way, each and every time? Automating your infrastructure may seem like a difficult and complicated task, but with readily available tools and templates it is now easier than ever before.
Why Infrastructure as Code Works
There are many advantages to automating your infrastructure builds through a process called Infrastructure as Code (IaC). Now that most applications and operating systems run in virtual environments on-premises or in a cloud, automating the build and configuration tasks offers many advantages:
- Fast and efficient builds of servers and applications
- Consistent configuration of settings
- Quick recovery of applications and dependent network components
- Continuous delivery pipeline
- Deploy on-premises or cloud using a consistent method
Getting started with IaC is not very difficult; it requires some basic knowledge using a scripting language such as PowerShell or Python. Even if you haven’t done any coding before, don’t let that keep you from trying IaC.
Gathering Your Tools
You will also need a code editor to make changes to the samples, such as VS Code, which is free and includes some powerful tools to integrate with just about everything. It is easy to learn and already includes native integration with Azure, Amazon Web Services (AWS) and dozens of scripting languages.
Utilizing Azure Automation
The next step is deciding on a platform from which to run the scripts either on demand, on a schedule or triggered from another action. Azure Automation can be used to automate any task from the most mundane to the most complicated. It primarily uses PowerShell to create runbooks from a gallery of prebuilt templates and activities that reduce the time and effort to start with automation. The runbooks can be either command-line interface (CLI) or even graphical, depending on your preference.
Azure Automation can also interact with Desired State Configuration (DSC) to automate the installation and configuration of software. DSC uses JSON templates, which contain the settings and installation configurations that are applied to a server. Using DSC will reduce the number of errors when building a server or service — no need to reference documentation.
When the dependencies of an application change, the runbook and DSC templates are updated. No need to update spreadsheets or lengthy documentation. The code that is created becomes the documentation needed to build a server or an entire infrastructure for an application.
As changes are made to the build process, it is done within the code. This will reduce the errors made when building infrastructure, since it doesn’t require a person to manually execute each step. Versioning will also be included with IaC because the code should be kept in a repository, such as GitHub, which allows edits to be made while also keeping previous versions.
Putting the Code to Work
Now that you’ve got a place to find some code and an editor setup, it’s time to pick a couple tasks to automate. These tasks are frequently done to build some infrastructure, which can be on a scheduled basis or on demand. For instance, building a web server would include creating a new virtual machine (VM) from a template; assigning memory, CPU and storage; then installing the necessary roles and software; finally configuring settings. Whatever task you choose, make sure it is a simple task that is done repeatedly and is time-consuming, such as building a server.
The process of building a server is one of the most common tasks to be automated. When building IaC, start with one portion of the build process, such as creating a VM. Then start to add modular pieces that can be reused, such as installing applications, creating virtual networks/load balancers or creating a group of servers for an application. The more methodical the approach, the easier it will be to troubleshoot issues and to add more steps.
Starting with IaC can be intimidating, especially to someone not familiar with code. By keeping the steps simple, the adoption of IaC is easy. Incrementally add progressively more difficult portions of your infrastructure until you are building an entire application from scratch.