Infrastructure as Code (IaC) – an Introduction

Infrastructure as Code, also known as IaC, is a tool for providing consistent, reliable, repeatable, and automated infrastructure provisioning and management using configuration files rather than the graphical user interface. The infrastructure and resources are defined using configuration files which you can repurpose, collaborate and manage versions.

There are several tools available that provide IaC functionality. These include:

  • AWS CloudFormation
  • Microsoft Azure Resource Manager
  • Terraform

What are the benefits of using Infrastructure as Code?

IaC helps speed up the resources set up so that you spend less time on resource management and more time focusing on the applications running on this infrastructure.
As these templates are text files, you can track differences in your templates to track changes to your infrastructure, similar to the way developers control changes to the application source code.

  1. Speed and efficiency 
  2. Consistency
  3. Reliability

Best Practices:

  1. Version control configuration files.
  2. The configuration file acts as a single source of truth.
  3. Test and monitor the configuration.

Infrastructure as CodeHow do we select what tools to use? 

When selecting a tool, we should consider the target deployment environment. For example, AWS CloudFormation is designed to provision and manage AWS infrastructure and works with other AWS offerings. You can use a single template to create and update an entire environment or separate templates to manage multiple layers within an environment. This enables templates to be modularized and provides a layer of governance that is important for many organizations. 

Terraform can manage infrastructure on multiple cloud platforms. Terraform is HashiCorp’s infrastructure as a code tool. It lets you define resources and infrastructure in human-readable, declarative configuration files and manages your infrastructure’s lifecycle.

Azure Resource Manager is the deployment and management service for Azure. It provides a management layer that enables you to create, update, and delete resources in your Azure account.

At Addteq, we use Cloudformation templates to provision the infrastructure on AWS for Atlassian applications.

Sample cloudformation template to provision an EC2 instance

The below sample code provisions an EC2 instance in AWS.
In the below sample code, we define the resource, i.e., EC2, that we want to provision. We can define the instance’s properties using parameters like the instance type, security group to assign to the instance, SSH key pair, and the image id to use to provision the instance.

    Type: AWS::EC2::Instance
        Ref: InstanceType
      - Ref: InstanceSecurityGroup
        Ref: KeyName
        - AWSRegionArch2AMI
        - Ref: AWS::Region
        - Fn::FindInMap:
          - AWSInstanceType2Arch
          - Ref: InstanceType
          - Arch

If you are just getting started with AWS Cloudformation templates, you can find more sample templates on AWS –

Want to learn more?

Related Content
Addteq Culture
From Adversity to Growth: Sonali's Journey of Healing and Professional Success with Addteq
Apart from Addteq's work from home policy, I can also choose my shifts. Flexible work hours allow me...
Confluence template
Streamlining Employee Performance Reports in Confluence
Learn how to efficiently manage employee performance reports in Confluence by take advantage of Excellentable...
Excellentable collaborative editing
Unleash the Power of Tables in Confluence with Excellentable
Excellentable transforms tables in Confluence, with unique view mode features like sharing searches,...

Leave a Reply

Your email address will not be published. Required fields are marked *