Quantcast
Channel: Cloud Training Program
Viewing all articles
Browse latest Browse all 1891

Google Cloud Deployment Manager : Overview & Hands on Guide

$
0
0

In this blog, we are going to cover  Google cloud Deployment Manager and everything related to it, but first, we need to learn about deployment, A deployment is an instantiation of a collection of resources which are defined in a configuration. A deployment can contain a lot of resources, over a variety of Google Cloud Platform services. So let’s move further and look at the topics we will discuss in this blog:

  1. Google Cloud deployment
  2. Deployment Features
  3. Configuration of cloud deployment manager
  4. Components of Cloud deployment manager
  5. Templates
  6. Creating compute engine VM using deployment manager

What Is Google Cloud Deployment Manager?

Google Cloud Deployment Manager is an infrastructure deployment service that automates the creation & management of Google Cloud Resources, It can be used to write flexible templates and configuration files, and use them to create deployments with multiple services (Cloud Storage, Compute Engine, Cloud SQL, etc.)

Google Cloud Deployment Manager also provides you the languages to use like Jinja or Python to define the resources you desire. This way, you can use declarative language to define the resources, and this will help you set their properties and granularities.

Setting up all the cloud resources for your application can be a difficult task. Once you decide what you need, you want the process for creating them to be easy, repeatable, and controlled. This is really important if you have multiple developers or administrators that needs to set up copies or variations of the same configuration.
Deployment Manager allows you to you specify the resources you want , instead of the process to create those resources . This will let you to focus on defining what you want to create, not every little deployment step.

                 google cloud deployment manager official icon

Deployment Manager Features

Deployment Manager has the following features:

  • Repeatable Deployment Process
  • Declarative Language
  • Focus on the application
  • Parallel Deployment
  • Template Driven

google cloud deployment manager features

Configuration

A configuration basically tells you the structure of your deployment, which includes the type and properties of the resources that are part of the deployment, any templates the configuration should use, and additional subfiles which can be executed in order to create your final configuration. You must always specify a configuration to create a deployment.

  •  A deployment is an instantiation of a set of resources that are defined in a configuration, it defines the structure of the deployment, including the type & properties of resources that are part of it
  • A configuration file is written in YAML syntax and is necessary to create a deployment
  • A deployment may contain several resources (Compute Engine, GKE, BigQuery, etc.); across a variety of Google Cloud Platform services

Configuration Limits

All configurations are there on the server-side within a controlled environment that Deployment Manager maintains. In order to prevent abuse, this environment is closely managed by the Deployment Manager team and has some limitations:

  • Both your original configuration and your expanded configuration can’t exceed 1 MB.
  • Any configurations which are uploaded to Deployment Manager are in a limited amount of time the configuration can take to run and the amount of processing power which the configuration consumes during expansion. If you run into this limitation, consider splitting your configuration into smaller templates, or simplifying complex structures such as recursion and nested loops.
  • Any Python templates which you use cannot make any system or network calls. These templates will automatically be rejected.

Components

Each resource has 3 components:

  • name -It s a user-defined string which is used 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 documentation.
  • properties – The parameters for this resource type. They must match with the  the properties for the type such as zone: asia-east1-a, boot: true

Templates

Templates allow you to separate your configuration into different pieces that you can use and reuse across different deployments. Templates can be as much generalized or specific as you need. With templates, you can also use the features like template properties, environment variables, modules, and other template functions to create dynamic configuration and template files.

  • While a simple configuration file is enough for simple workloads, more complex ones require it to be broken into templates.
  • A template is a file that is imported and used as a type in configuration.
  • There can be multiple templates in a configuration
  • Templates can be written in Jinja 2.10.x (close to YAML) or Python 3.x

Python and jinja logo

Creating Compute Engine VM using Deployment Manager

Now that you are familiar with the Cloud Deployment Manager, configuration, components & templates, let’s look at a small demo on how to create a compute engine VM using the Google cloud deployment manager.

1. Log in to your Google Cloud Platform account

Note: If you don’t have a free trial account then check our  Step-by-Step guide to create your Google Cloud Free-trial account now.

2. Select your existing project or if you do not have one then click on create a new project

google cloud deployment manager console login

 

3. In the Cloud Console, open cloud shell

Opening cloud shell

4. Run the following command to create a template file

nano vm-deploy.yaml

5. A template file will open. Copy the below YAML code in the file

Note: You can copy the code from this word file or from the below link:

https://k21academy.s3-us-west-2.amazonaws.com/Google_Cloud_ACE/Hands_On/Module_12/DeploymentManager_Code.rtf

vm-deploy.yaml

6. Exit the text editor (CTRL+X)

7. If the confirmation appears press Y

8. press Enter

9. In the Cloud shell copy the below command to create a deployment from the template:

gcloud deployment-manager deployments create vm-deployment --config vm-deploy.yaml

deployment from the template

10. If prompted, click on Authorize

Authorize

11. Make sure the Deployment Manager API is enabled else when prompted type y in the cloud shell when asked to enable

12. You can see that the VM instance and firewall rule is deployed

Instance and firewall successfully deployed

Verify The VM Instance Created

Now that we have created the VM instance through the template file in the deployment manager, let’s cross-check in the console if the VM is created or not!

13.  In the Cloud Console, navigate to Navigation menu > Compute Engine

navigate to compute engine

14. You can check that our VM instance has been deployed (cloud-vm)

google cloud deployment manager successful VM creation

Conclusion

This is what Google cloud deployment manager is and as we have seen cloud-vm instance is easily deployed through deployment manager, you can create many more instances as per your choices

Google Deployment Manager pros:

  • You can use python and perform your custom logic execution within the templates
  • No need to manage the state by yourself as it is a hosted solution
  • Works with most number of GCP API calls
  • Can be used to manage Kubernetes state

Related References

Next Task For You

If you are also interested and want to know more about the Google Professional Cloud Architect certification then register for our Free Class.

Free class

The post Google Cloud Deployment Manager : Overview & Hands on Guide appeared first on Cloud Training Program.


Viewing all articles
Browse latest Browse all 1891

Trending Articles