Infrastructure is one of the core tenets of a software development process—it is directly responsible for the stable operation of a software application. This infrastructure can range from servers, load balancers, firewalls, and databases all the way to complex container clusters. Show
Infrastructure considerations are valid beyond production environments, as they spread across the complete development process. They include tools and platforms such as CI/CD platforms, staging environments, and testing tools. These infrastructure considerations increase as the level of complexity of the software product increases. Very quickly, the traditional approach for manually managing infrastructure becomes an unscalable solution to meet the demands of DevOps-based modern rapid software development cycles. And that’s how Infrastructure as Code (IaC) has become the de facto solution in development today. IaC allows you to meet the growing needs of infrastructure changes in a scalable and trackable manner. Infrastructure as Code or IaC is the process of provisioning and managing infrastructure defined through code, instead of doing so with a manual process. As infrastructure is defined as code, it allows users to easily edit and distribute configurations while ensuring the desired state of the infrastructure. This means you can create reproducible infrastructure configurations. Moreover, defining infrastructure as code also:
Declarative vs imperative Infrastructure as CodeWhen dealing with IaC tools, there are two major differentiating approaches for writing code. These two approaches are declarative and imperative. Simply put:
The declarative approach is preferred in most infrastructure management use cases as it offers a greater degree of flexibility when managing infrastructure. Chef is considered an imperative tool, where Terraform, Pulumi, CloudFormation, ART, Puppet are all declarative. Uniquely, Ansible is mostly declarative with support for imperative commands. IaC vs IaaSImportantly, IaC is not a derivative of infrastructure as a service (IaaS). They are two different concepts.
When & how to use Infrastructure as CodeIaC may seem unnecessary for simpler, less complex infrastructure requirements, but that isn’t accurate. Any—every—modern software development pipeline should use infrastructure as Code to handle the infrastructure. Besides, the advantages of IaC far outweigh any implementation and management overheads. Advantages of IaCHere are the top benefits of IaC:
When to use IaCNot sure when to use IaC? The simplest answer is whenever you have to manage any type of infrastructure. However, it becomes more complex with the exact requirements and tools. Some may require strict infrastructure management, while others may require both infrastructure and configuration management. Then comes platform-specific questions like if the tool has the necessary feature set, security implication, integrations, etc. On top of that, the learning curve comes into play as users prefer a simpler and more straightforward tool than a complex one. The below table shows a categorization of the tools mentioned above according to their ideal use cases.
One tool may not be sufficient in most scenarios. For instance, Terraform may be excellent for managing infrastructure across multiple cloud environments yet may be limited when in-depth configurations are required. In those kinds of situations, users can utilize a tool such as Ansible to carry out the necessary configurations. Likewise, users can mix and match any IaC tool and use them in their CI/CD pipelines depending on the exact requirements. (Learn how to set up your own CI/CD pipeline.) Infrastructure as Code tools & platformsUnder the big IaC umbrella, there are all sorts of tools, from dedicated infrastructure management tools to configuration management, from open-source tools to platform-specific IaC options. Let’s look at some of the most popular IaC tools and platforms. TerraformTerraform by HashiCorp is the leading IaC tool specialized in managing infrastructure across various platforms from AWS, Azure, GCP to Oracle Cloud, Alibaba Cloud, and even platforms like Kubernetes and Heroku. As a platform-agnostic tool, Terraform can be used to facilitate any infrastructure provisioning and management use cases across different platforms and providers while ensuring the desired state across the configurations. AnsibleAnsible is not a dedicated Infrastructure management tool but more of an open-source configuration management tool with IaC capabilities. Ansible supports both cloud and on-prem environments and can act through SSH or WinRM as an agentless tool. Ansible excels at configuration management and infrastructure provisioning yet is limited when it comes to managing said infrastructure. (Find out why people often compare Ansible & Control-M.) PulumiPulumi is a relatively new tool that aims to provide a developer-first IaC experience. Unlike other tools that force users to use a specific language or format, Pulumi offers freedom to use any supported programming language any way they like. This tool supports Python, TypeScript, JavaScript, Go, C#, F#, and the state is managed through Pulumi service by default. Chef/PuppetChef and Puppet are two powerful configuration management tools. Both aim to provide configuration management and automation capabilities with some infrastructure management capabilities across the development pipeline.
(Check out Puppet’s State of DevOps report.) CFEngineCFEngine is one of the most mature tools solely focused on configuration management. Even though there is no capability to manage the underlying infrastructure, CDEngine can accommodate even the most complex configuration requirements, covering everything from security hardening to compliance. AWS CloudFormationCloudFormation is the AWS proprietary platform specific IaC tool to manage AWS infrastructure. CloudFormation has deep integration with all AWS services and can facilitate any AWS configuration as a first-party solution. Azure Resource TemplatesMicrosoft Azure uses JSON-based Azure Resource Templates to facilitate IaC practices within the Azure platform. These resource templates ensure consistency of the infrastructure and can be used for any type of resource configuration. In addition to the above, there are specialized tools aimed at specific infrastructure and configuration management tasks such as:
(Get acquainted with Azure DevOps.) Examples of Infrastructure as CodeLet’s consider a simple scenario of provisioning an AWS EC2 Instance. In the following example, we can see how Terraform, Ansible, and AWS CloudFormation codes are used for this requirement. Terraformterraform { required_providers { aws = { source = "hashicorp/aws" version = "~> 3.27" } } } provider "aws" { access_key = "aws_access_key" secret_key = "aws_secret_key" // shared_credentials_file = "/Users/.aws/creds" region = "us-west-1" } resource "aws_instance" "web_server" { ami = "ami-0123456" instance_type = "t3.small" subnet_id = "subnet-a000111x" vpc_security_group_ids = "sg-dfdd00011" key_name = "web_server_test_key" tags = { Name = "Web_Server" } } Ansible- hosts: localhost gather_facts: False vars_files: - credentials.yml tasks: - name: Provision EC2 Instance ec2: aws_access_key: "{{aws_access_key}}" aws_secret_key: "{{aws_secret_key}}" key_name: web_server_test_key group: test instance_type: t3.small image: "ami-0123456" wait: true count: 1 region: us-west-1 instance_tags: Name: Web_Server register: ec2 AWS CloudFormationAWSTemplateFormatVersion: "2010-09-09" Resources: WebInstance: Type: AWS::EC2::Instance Properties: InstanceType: t3.small ImageId: ami-0123456 KeyName: web_server_test_key SecurityGroupIds: - sg-dfdd00011 SubnetId: subnet-a000111x Tags: - Key: Name Value: Web_Server A real world example: IaC for DevOpsWithin the context of software development, a fundamental constraint is the need for the environment where recently developed software code is tested to exactly mirror the live environment where such code will be deployed to. This is the only way of assuring that the new code will not collide with existing code definitions: by generating errors or conflicts that may compromise the entire system. In the past, software delivery would follow this sort of pattern:
(Understand the differences between deploying & releasing software.) Manual recreation of a live environment leaves doors open to a multitude of most likely minor but potentially quite important human errors, regarding:
A live environment clone, created using the exact same IaC as the live environment, has the absolute guarantee that that if it works in the cloned environment it will work in live. Imagine a software delivery process involving separate environments for DEV, UAT, and Production. There’s seemingly little value in having a DEV and UAT environment that isn’t an exact mirror of the prod environment given that those early environments are critical to measuring the quality and production readiness of a software build version. The introduction of virtualization enabled this process to be expedited, especially regarding the phase of creating and updating a test server that would mirror the live environment. Yet the process was manual, meaning a human would have to create and update the machine accordingly and in a timely fashion. With the introduction of DevOps, these process became even more “agile”. Adding automation to the server virtualization and testing phases replaces human intervention, improving productivity and efficiency. To summarize: In the past, several man-hours and human resources were required to complete the software deployment cycle (Developers, Systems Administrators, Database Administrators, Operation testers). Now, it is possible to have the developer alone complete all tasks:
Quick, trackable infrastructure changesInfrastructure as Code has become a vital part of modern application development and deployment pipelines. It is achieved by facilitating quick and trackable infrastructure changes that directly integrate into CI/CD platforms. Infrastructure as Code is crucial for both:
Getting started with Infrastructure as Code may seem daunting with many different tools and platforms targeted at different use cases. However, cross this hurdle, and you will have a powerful infrastructure management mechanism at your fingertips. Related reading
These postings are my own and do not necessarily represent BMC's position, strategies, or opinion. See an error or have a suggestion? Please let us know by emailing . What is infrastructure as a code in AWS?Practicing infrastructure as code means applying the same rigor of application code development to infrastructure provisioning. All configurations should be defined in a declarative way and stored in a source control system such as AWS CodeCommit , the same as application code.
Which of the following are parts of the AWS global infrastructure?The components are:. Availability Zones (AZs). Regions.. Edge Locations.. Regional Edge Caches.. How infrastructure code is processed or executed in AWS?In AWS, The code for infrastructure will be in simple JSON format. This JSON code will be organized into files called templates. This templates can be deployed on AWS devops and then managed as stacks.
What are features of the AWS infrastructure?Amazon Cloud Directory Features. Overview. ... . Powerful data and relationship management. ... . Flexible schema management. ... . Fully-managed infrastructure. ... . Searching across objects and relationships. ... . Built-in data encryption. ... . Object policies.. |