Updated: Jul 30
DevOps wouldn't be possible without "Infrastructure as a code." This blog is about IaC fundamentals and best practices.
What is IaC:
Infrastructure as code is the ability to provision and manage infrastructure using a configuration language. It is about treating infrastructure configuration and provisioning the same way you treat your application source code. The configuration modules are typically stored in version control systems in well-documented code formats, providing greater accuracy, reducing errors, and increasing speed and consistency.
IaC allows DevOps teams to use different tools and approaches to automatically control and customize the required infrastructure instead of manually configuring the servers and operating systems. With the increase in production and delivery cycles, the use of Infrastructure as Code (IaC) tools has changed how software engineers design, test, and release their applications.
How can one start with Infrastructure as Code
There are 2 approaches for writing Infrastructure as Code
Imperative infrastructure as code consists of commands that manipulate a system's configuration and state, often by executing scripts on the system itself.
Imperative Infrastructure as Code focuses on describing what you need your infrastructure to do
Declarative infrastructure as code instead configures a system or provides a desired state, specifying rules or relationships without specifying how those goals are achieved.
Declarative is more powerful as it ensures that the desired configuration is maintained across all parts of your system. It also makes it easy to manage changes and deployments.
Top IaC tools in 2022
• AWS CloudFormation
• Azure Resource Manager
• Google Cloud Deployment Manager
The most popular and open-source tool for infrastructure automation. It helps in configuring, provisioning, and managing the infrastructure as code.
Easily plan and create IaC across multiple infrastructure providers with the same workflow.
Uses the declarative approach to define the required infrastructure as code.
Users can do a pre-execution check to validate whether the configurations meet the result expectations or not before updating or provisioning the infrastructure.
Enables users to have their desired infrastructure across multiple cloud providers through a single and consistent CLI workflow.
Quickly provision multiple environments using the same configuration and manage the entire lifecycle of your desired infrastructure
Simple IT automation platform that makes your systems and applications easier to deploy and maintain. Automate everything from code deployment to network configuration to cloud management.
It aims to provide large productivity gains to a wide variety of automation challenges.
Product of RedHat developed Ansible with an idea to promote simplicity contributes towards IT modernization and helps DevOps teams to have faster, more reliable, and coordinated application deployments.
Quickly establish multiple identical environments with security baselines without worrying about fulfilling compliance requirements.
Ansible is considered the simplest way to automate the provision, configuration, and management of applications and IT infrastructure.
Ansible enables users to execute playbooks to create and manage the required infrastructure resources using agentless meachanism.
Code is written in YAML as Ansible Playbooks, making it easy to understand and deploy the configurations over passwordless SSH/WinRM connections.