Deployment Manager is an infrastructure deployment service that automates the creation and management of Google Cloud Platform (GCP) resources for you.
You can write flexible template and configuration files and use them to create deployments that have a variety of GCP services, such as Cloud Storage, Compute Engine, and Cloud SQL, configured to work together.
Deployment Manager uses a system of templates to consistently deploy GCP resources. You create files to instruct Deployment Manager.
The files are of three types:
- A configuration file, which drives the deployment; this is a YAML file.
- Template files which implement specific resources; these are written in either Jinja 2.7.3 or Python 2.7.
- Schema files, which are a set of rules that a configuration file must meet to be allowed to use a particular template; you won’t use schema files in this lab.
The concept behind Deployment Manager is “infrastructure as code.” You can treat the templates like code, placing them under version control in a repository, and so forth.
In this lab, you used commands to run Deployment Manager. However, the same functionality is also available through the API for even greater leverage.
- In Cloud Shell, to list the types of GCP resources that you can control using Deployment Manager, run the following:
gcloud deployment-manager types list or gcloud deployment-manager types list | grep "v1" | sort (Lists production services only)
A huge configuration file can be difficult to manage. Templates are a way to break down configurations into composable units that can be separately updated and can be reused. Templates are included in the *.yaml configuration using
Here are some of the benefits of Deployment Manager templates:
- Composability: Easily manage and maintain definitions.
- Reusability: Easily reuse definitions across deployments.
- Maintainability: Maintain consistent definitions in one place.
The Deployment Manager configuration and template files use two kinds of variables: template variables and environment variables.
Template variables are abstract properties that allow you to declare the value to be passed to the template in the *.yaml configuration file. You can change the value for each deployment in the *.yaml file without having to make changes to the underlying templates. Example: Passing zone as a template variable allows you to start a test deployment in a different zone from the production deployment.
Environment variables allow you to reuse templates in different projects and deployments. Instead of representing properties of resources, they represent more global properties such as a Project ID or the name of the deployment. Example: You want to start the same deployment in two projects: proj-east and proj-west. You could declare environment variables for the two Project IDs and then use these in the Deployment Manager configuration files.
For more information, see: https://cloud.google.com/deployment-manager/docs/