Google Cloud Deployment Manager Basics

Google Cloud Deployment Manager is an infrastructure deployment service that automates the creation and management of Google Cloud resources. By using Infrastructure as Code (IaC), it allows Cloud Engineers to define their environment in a declarative format, ensuring consistency, repeatability, and speed across different projects and environments.

The Blueprint Analogy

Think of Deployment Manager as a Master Architect’s Blueprint. If you were building a skyscraper, you wouldn’t just tell workers to “start laying bricks” and hope they end up with a 50-story building. Instead, you provide a highly detailed blueprint (the YAML file) to a general contractor (Deployment Manager). The contractor looks at the blueprint, calculates exactly how many windows, steel beams, and wires are needed, and executes the build precisely as specified. If you want a second identical skyscraper, you simply hand the same blueprint to another contractor.

Detail Elaboration: How It Works

Deployment Manager uses a declarative approach. Instead of writing a script that says “Create a VPC, then create a Subnet, then create a VM” (imperative), you write a configuration file that says “I want a VPC, a Subnet, and a VM to exist.” Deployment Manager handles the underlying API calls and the order of operations.

Key Components:

  • Configuration: A YAML file that describes all the resources you want in a single deployment.
  • Templates: Reusable parts of your configuration written in Python or Jinja2. These allow you to parameterize your deployments (e.g., changing the machine type based on the environment).
  • Resources: The individual GCP components (Compute instances, Cloud SQL, BigQuery datasets, etc.) defined in the configuration.

Core Concepts & Best Practices

1. Operational Excellence: Repeatability

By defining infrastructure in code, you eliminate “Configuration Drift.” You can version control your YAML files in Git, allowing you to audit changes over time and roll back to previous infrastructure states if a deployment fails.

2. Reliability: Preview Mode

Always use the --preview flag when updating a deployment. This allows you to see what Deployment Manager intends to do (create, delete, or update) before any actual changes are applied to your production environment.

3. Security: Principle of Least Privilege

Deployment Manager uses a service account to perform actions. Ensure the “Google Cloud Deployment Manager Service Agent” has the necessary IAM roles to create the resources specified in your templates.

Service Comparison: IaC Options in GCP

Feature Deployment Manager Terraform (HashiCorp) gcloud CLI / Console
Type Native GCP IaC Cloud-Agnostic IaC Manual / Scripted
Language YAML, Python, Jinja2 HCL (HashiCorp Configuration Language) Bash/PowerShell/UI
State Management Managed by GCP Managed by User (State files) No State Management
Best Use Case GCP-only environments, deep integration Multi-cloud environments One-off tasks, prototyping

Decision Matrix: When to Use What?

If the Requirement is… Use this Service/Feature…
Deploying a standard 3-tier app repeatedly across Dev/Test/Prod Deployment Manager with Jinja2 Templates
Testing a single VM configuration quickly without code Google Cloud Console
Managing resources across GCP, AWS, and Azure simultaneously Terraform
Viewing the impact of a configuration change before applying it Deployment Manager --preview flag

Exam Tips for the ACE Certification

  • The Manifest: Remember that a Manifest is a read-only object that contains the original configuration and the expanded resources. It is created every time you update a deployment.
  • YAML Syntax: The configuration file must always start with resources:. Each resource must have a name, type, and properties.
  • Deletion Policy: Understand the abandon policy. If you set deletePolicy: ABANDON, Deployment Manager will stop managing the resource but will not delete the actual resource in GCP when the deployment is deleted.
  • Composite Types: These are custom templates you’ve registered with Deployment Manager to be reused like native types.

Deployment Manager Architecture

config.yaml Deployment Manager (API Engine) Compute Engine Cloud Storage Cloud SQL

Flow: Configuration Input → Expansion → Resource Creation

Key GCP Services

  • Jinja2: Logic-based templating.
  • Python: Complex programmatic templates.
  • gcloud: The CLI tool used to execute deployments.

Common Pitfalls

  • Hardcoding: Avoid hardcoding zone names; use variables.
  • Circular Deps: Resource A waiting for B, while B waits for A.
  • Manual Edits: Changing resources in Console breaks the IaC logic.

Architecture Patterns

  • Multi-tier: Separate templates for Network, DB, and App.
  • Template Libraries: Reusing the same “Hardened VM” template across teams.

*You only pay for the underlying resources created (VMs, Disks, etc.)

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top