Infrastructure as Code (IaC) is a modern cloud best practice that lets you create, manage, and update cloud resources using code instead of clicking in the console.
Instead of manually configuring servers, networks, and storage, you define everything in machine-readable files (like YAML, JSON, or templates). Google Cloud then automatically builds your environment exactly as described.
👉 In simple terms:
IaC = Cloud infrastructure managed with code
In Google Cloud, IaC is essential for managing services like:
• Compute Engine (VMs)
• Cloud Storage
• Cloud SQL
• VPC networks
• Load balancers and firewalls.
Google Cloud Deployment Manager (GCP’s Native IaC Tool)
Google Cloud Deployment Manager is GCP’s built-in Infrastructure as Code service.
It allows you to define and deploy Google Cloud resources using:
• YAML configuration files
• Jinja templates
• Python templates
With Deployment Manager, you can:
✔ Automatically create Google Cloud resources
✔ Deploy complex environments in one step
✔ Reuse templates across multiple projects
✔ Maintain consistent, repeatable cloud setups
💡 CDL Exam Tip:
If the question mentions configuration files, automation, or repeatable deployments, think 👉 Deployment Manager
Example: Creating a VM with Infrastructure as Code
Here’s what a VM configuration in IaC typically does:
• Creates a virtual machine named example-vm
• Uses a Debian 11 operating system
• Deploys the VM in the us-central1-a zone
• Connects the VM to the default VPC network
Instead of clicking through the console, you define all this once in a config file and deploy it automatically.
resource "google_compute_instance" "vm" {
name = "example-vm"
machine_type = "e2-medium"
zone = "us-central1-a"
boot_disk {
initialize_params {
image = "debian-cloud/debian-11"
}
}
network_interface {
network = "default"
}
}
For the CDL exam, remember:
✔ IaC = Automated, consistent cloud environments
✔ Deployment Manager = GCP’s IaC tool
✔ YAML/Jinja/Python templates = How resources are defined
✔ Best practice = Avoid manual configuration when possible
Leave a comment