Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”. This article also participated in the “Digitalstar Project” to win a creative gift package and creative incentive money.

The previous articles covered infrastructure code tools, but not what IaC is, so this article will give you a brief overview.

I. Choice of history

As software iterates rapidly and complexity increases, organizational structures and functions change.

  • In the first phase, development (Dev) and operations (Ops) organizations are separated, with development writing software and operations managing hardware. → Problems: cross-team collaboration, inconsistent development and operation and maintenance environments, most deployment of operation and maintenance personnel completed manually, code conflicts, service failures and downtime are frequent.
  • In the second stage, on the cloud computing platform, the task of the operation and maintenance team is transferred from hardware management to software management, which requires the writing of codes. In this way, both development and operation need to write codes, so Dev and Ops merge and evolve intoDevOps.

The goal of DevOps automation is to automate software delivery processes. Therefore, as far as the management infrastructure is concerned, it should be implemented as much as possible through code, and less clicking on web pages or manually executing Shell commands, namely using IaC (Infrastructure is code).

Ii. Go to IaC

IaC (Infrastructure as Code) defines, deplores, updates, and destroys Infrastructure by writing and executing Code.

It’s a shift in thinking about operations as software-related, even explicitly hardware-specific, where everything is managed in code, including

  • The server
  • The database
  • network
  • The log file
  • Application configuration
  • The document
  • Automate testing and deploy processes

2.1 Value of IaC solutions

  • Version Control (reviewable)
  • Establish CI/CD automation (independent of UI operations and reduce human error)
  • Reuse (reduce time wasted)
  • Environment switching control (maintain consistency of production, pre-delivery and test environments, smooth switching)
  • Team growth and collaboration (document sharing)

In general, the repetitive process of manually managing the infrastructure is tedious, and without creativity or challenge, using Iac allows us to focus on more valuable things while improving our work.

2.2 CLASSIFICATION of IaC Tools

IaC is an idea, and there are many tools to implement it, roughly divided into five categories.

  • Special script (Write a special script for each task, such as configuring the Docker environment, configuring web services, etc. It is quite difficult to maintain and can be used for small, one-off tasks.)
  • Chef, Puppet, Absible, and SaltStack (Chef, Puppet, Absible, SaltStack, etc.) are designed to install and manage software on existing servers. They are better than special scripts and can be used for large-scale, distributed, unified management scenarios.
  • Server template tools (Docker, Packer, and Vagrant fall into this category, using container images, virtual machines (VMS), and having a completely separate server installed on all servers)
  • Orchestration tools (manage server template tools to create VMS and containers, including K8s, Marathon/Mesos, AmazonElastic Container Service (Amazon ECS), Docker Swarm, Nomad, and more)
  • Service creation tools (create cloud resources, such as servers, networks, firewall facilities, routing rules, load balancing, etc., including Terraform, CloudFormation, OpenStack Heat, Pulumi, etc.)