How to deploy resources with Deployment Manager in GCP


What is Deployment Manager in GCP

Deployment Manager is a service offered by Google Cloud Platform (GCP) that enables users to automate and operate resources within their cloud infrastructure. When deploying resources, the instances used are grouped and managed into units and their implementation is known as a deployment. With the help of additional utilities such as flexible templates and customized configuration files, users can automate and repeat deployments in set combinations for a wide variety of services such as Google Cloud Storage, Google Compute Engine, and Google Cloud SQL.

In this article we will discuss the basics of using GCP Deployment Manager, its components, and their importance.


A configuration file defines all the resources needed for a single deployment. It is written in a YAML format and includes all of the resources you intend to build as well as their associated resource characteristics. It must contain a resources: proceeded by a the list of resources you wish to create.

Having the following components is essential for each resource:

  • name – A user-defined string to identify this resource such as my-vm, project-data-disk, the-test-network.
  • type – The type of the resource being deployed such as compute.v1.instance, compute.v1.disk. The base resource types are described and listed on the Supported Resource Types GCP documentation.
  • properties – The parameters for this resource type. They must match the properties for the type such as zone: asia-east1-a, boot: true.

To learn more on how to create and activate a basic YAML configuration file, you can visit GCP’s Creating a Basic Configuration Page.


GCP Deployment Manager Templates allows you to define a standard set or resources and reuse them throughout different deployments as per your requirement. They are essential parts of the configuration file, i.e. individual building blocks. This proves to be especially convenient when there are instances where similar configuration files are needed. Templates can be used to store the shared parts and reused appropriately, since they are comparatively flexible and portable through deployments when compared to configuration files.

Python or Jinja2 are the languages exclusively used to create a template file. Each template will be sequentially analyzed by the Deployment Manager system, and the output aligned within the configuration file. As a result, each template’s interpretation yields the identical YAML syntax for resources as that specified for that particular configuration file.

A repository of templates is available on Github, and provides users with multitudes of options and examples to take references from.

Sample Deployment

We’ll now use Deployment Manager to construct a Compute Engine instance. The following will be the configuration of the Compute Engine :

Zone: us-central1-f

Machine type: f1-micro

Image: debian-9

The YAML file named vm.yaml for this deployment will look like this:

- name: vm-created-by-deployment-manager
type: compute.v1.instance 
zone: us-central1-a machineType: zones/us-central1-a/machineTypes/f1-micro 
- deviceName: boot 
boot: true 
autoDelete: true 
initializeParams: sourceImage: projects/debian-cloud/global/images/family/debian-9 
- network: global/networks/default

Cloud Shell Deployment Manager

Now, that the config file is ready we can create a Compute Engine using the following command in the terminal:

gcloud deployment-manager deployments create economize-deployment --config vm.yaml
VM by Deployment Manager

*Please note that Google sets a default label goog-dm when made using deployment manager.

Benefits of GCP Deployment Manager

Instead of going through the process of creating resources, Deployment Manager allows you to define the resources you want. This allows you to concentrate on defining what you want to develop rather than on the details of deployment.

Deployment Manager contains significant advantages when it comes to allocating resources to your GCP environment, such as:

  • Create a template for your infrastructure deployment and deploy it using the command line or a RESTful API.
  • For deployments needing logic, templates accept Jinja or Python, allowing you to use programming elements like loops, conditionals, and parameterized inputs.
  • In Google Developers Console, UI functionality for inspecting and removing deployments has been included.
  • Google Cloud Platform resources are deeply integrated, from computing to storage to networking, allowing for quicker deployment administration and visibility.
  • Developers Console now has UI support for Deployment Manager, enabling you to see the architecture of your deployments.


Arranging all of your platform’s cloud resources might be a tedious undertaking. Ideally, the process of developing them should be simple, repeatable, and regulated after you’ve decided what you need. This holds especially true if you have several developers and administrators that need to set up copies or variants of the same configuration.

Deployment Manager enables you to automate the creation and management of all your GCP resources in a very straightforward manner. Demand oriented scalability is made feasible through familiar elements such as YAML, Jinja, and Python. For deploying workloads to GCP, Deployment Manager is relatively the most convenient and effective solution for your needs.

Discover what’s possible

Help me reduce my cloud costs

You're spending a lot on cloud — but do you know how much?
We are committed to making your cloud spend simpler and help you optimize it.

You should also check out this other helpful content.

The Marketing Automation Essentials

Learn all you need to know about marketing automation and customer journeys.

The Marketing Automation Essentials

Learn all you need to know about marketing automation and customer journeys.

Get started with Economize today

With our powerful recommendations and easy-to-use tool, it's never been easier to reduce your cloud costs.
add_action( 'wp_footer', function() { if ( ! defined( 'ELEMENTOR_VERSION' ) ) { return; } ?>