Junior — Middle
What is meant by the 'Infrastructure as Code' approach and how is it applied in practice?
sobes.tech AI
Answer from AI
The approach of "Infrastructure as Code" (IaC) refers to the practice of managing and configuring infrastructure (servers, networks, databases, etc.) using code rather than manual actions.
This allows:
- Automating deployment and configuration
- Versioning infrastructure
- Ensuring repeatability and consistency
In practice, IaC is implemented using tools such as Terraform, Ansible, Puppet, Chef, etc. For example, with Terraform, you can describe infrastructure in configuration files and then automatically create the necessary resources in the cloud.
An example of a simple Terraform configuration for creating a virtual machine:
provider "aws" {
region = "us-west-2"
}
resource "aws_instance" "example" {
ami = "ami-0c55b159cbfafe1f0"
instance_type = "t2.micro"
}
Thus, infrastructure becomes manageable, verifiable, and reproducible as regular code.