AWS IaC Stories #01: Introduction
Tags: aws, devops, cloud, community
Published: 2022-09-15 06:58:09

According to ITIL, “IT infrastructure” refers to the entire collection of hardware, software, networks, facilities, etc. (together with all information technology-related devices) needed to create, test, provide, monitor, control, or support IT services. It’s no secret that automation is a persistent, developing trend in IT.

Within the scope of a software development project, if you have a complex architecture, it requires an intense workforce to set up the servers, storage, and network for test/staging and production environments and make the necessary configurations on them, and repeat this constantly.

Thanks to cloud computing and virtualization, It is now possible to accomplish more with less manual involvement.

A DevOps technique called Infrastructure as a Code (IaC), often known as programmable infrastructure, streamlines, accelerates and makes it easier to manage your infrastructure. Infrastructure as code, or IaC, is the process of provisioning and managing infrastructure described by code as opposed to manually. For example, you can handle the following operations with IaC Tools.

- Virtual Server Provisioning
- Install Tools, Packages, SDKs, Frameworks, etc.
- Create users
- Configure Database Servers
- Configure Infrastructure (Load Balancers, Firewalls, etc.)

## Advantages of IaC
**Reusability:** You can quickly reuse a ready-made template according to the target system or platform and quickly raise your environment on the new platform.
**Fast Provisioning:** Automation is faster than Manual Intervention
**Consistency:** You might forget the steps in an installation scenario, but the infrastructure built with IaC will provide a more accurate and consistent installation
**Version Control:** Maintaining versions of each code snippet is important for change management. You can also version IaC code snippets and track the evolution of your infrastructure over time.

## How IaC Works

!["Here’s a simple diagram displaying the IaC flow"](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j55r0rsefc4eqf4rkiv7.jpg)

There are two common approaches to writing Infrastructure as Code

- Declarative Approach
- Imperative Approach
The distinction between declarative, imperative, and intelligent approaches is ‘what’ vs ‘how’ vs ‘why.’

**Declarative (functional):** The declarative method specifies the target’s ideal configuration, or what the target’s desired state should be. There are no instructions about how to set up a server. Instead, a list of prerequisites or external software needed to set up the server or infrastructure is defined.

**Imperative (Procedural):** The imperative method specifies the orders that must be carried out in order to get the intended result. The imperative focuses on altering the infrastructure to achieve the desired outcome.

Also, these tools use two methods to manage the infrastructure

- Push: The server pushes the configuration to the target system
- Pull: The target system pulls the configuration from the server

## IaC Tools
We’ll look at a few IaC tools in an Amazon Web Services context in this post.

<table><tbody><tr><th>Tool</th><th>Developer</th><th>Language</th><th>Approach</th><th>Method</th></tr><tr><td>Ansible</td><td>Red Hat</td><td>YAML</td><td>Declarative and imperative</td><td>Push</td></tr><tr><td>Puppet</td><td>Puppet</td><td>DSL</td><td>Declarative and imperative</td><td>Pull</td></tr><tr><td>Chef</td><td>Progress</td><td>DSL</td><td>Declarative and imperative</td><td>Pull</td></tr><tr><td>Terraform</td><td>Hashicorp</td><td>HCL/JSON</td><td>Declarative and imperative</td><td>Push</td></tr><tr><td>SaltStack</td><td>Thomas S Hatch</td><td>YAML</td><td>Declarative and imperative</td><td>Push and Pull</td></tr><tr><td>AWS CLoudFormation</td><td>Amazon</td><td>YAML/JSON</td><td>Declarative and imperative</td><td>Push</td></tr></tbody></table>

We will be reviewing all these tools and looking at their details in later articles in the series.