Infrastructure as Code is defining your whole organization infrastructure as lines of code which can be versions and can be treated as plugin, disposable and snappy. This helps us to define our infrastructure as something that is pluggable.

IAC are configuration files that help are used to define and deploy infrastructure. A IAC configuration file consists all information needed to setup the infrastructure that includes all the connectivity(networks), virtual machines, load balancers and other preboot-custom commands.

There are several popular Infrastructure as Code (IAC) tools available, both open source and vendor-specific. Some of the popular open-source IAC tools are:

Open-source IAC tools:

Below are the Open-source Iac tools which are cloud agnostic means you can use them with all major cloud providers (AWS,Azure, GCP and others).

Terraform: A tool for building, changing, and versioning infrastructure safely and efficiently.

Ansible: A configuration management tool that uses YAML-based playbooks to provision, configure, and orchestrate infrastructure.

Chef: A configuration management tool that uses Ruby-based cookbooks to define infrastructure configurations.

Puppet: A configuration management tool that uses a declarative language to define infrastructure configurations.

SaltStack: A configuration management tool that uses a Python-based language to define infrastructure configurations.

Vendor-Specific IAC tools:

Below tools are some vendor-specific tools that only work with their respective cloud vendor.

AWS CloudFormation: A service that helps you model and set up your Amazon Web Services resources so that you can spend less time managing those resources and more time focusing on your applications that run in AWS.

Azure Resource Manager: A service that allows you to create and manage Azure resources using a declarative template.

Google Cloud Deployment Manager: A service that allows you to define your Google Cloud Platform resources as templates and manage them through versioning and deployment workflows.

IBM Cloud Schematics: A service that allows you to automate infrastructure provisioning and management on IBM Cloud using Terraform, Ansible, or other popular IAC tools.

Example of an IAC:

resource "aws_instance" "helloworld" {
  ami           = "ami-007855ac798b5175e"
  instance_type = "t2.micro"
  tags = {
    Name = "HelloWorld"
  }
}

Above terraform configuration file(.tf) will launch an ec2 instance in aws.when you run command

terraform apply


Terraform from hashicorp, can be used to launch and manage infrastructure across multiple cloud vendors. Terraform is a popular IAC tool which provides more readability as compared with other IAC tools like AWS Cloud formation, Azure Resource Manager Templates.

Benefits of IAC:

Reproducibility: IAC ensures that the same infrastructure can be recreated every time it’s needed. This is particularly useful for testing, development, and disaster recovery scenarios.

Scalability: Managing infrastructure at scale becomes easy. You can quickly create and destroy resources as needed, without having to worry about manual intervention.

Consistency: Infrastructure is configured in the same way each time, reducing the risk of misconfiguration and security vulnerabilities.

Version control: making it easier to track changes, collaborate with others, and roll back changes if necessary.

Automation: IAC tools enable you to automate many routine infrastructure tasks, freeing up your time to focus on higher-level strategic work.

AWS CloudFormation
Terraform
Ansible
Chef
Puppet
SaltStack
Azure Resource Manager
Google Cloud Deployment Manager
OpenStack Heat
Kubernetes