Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Labs

Deploying Resources with Google Cloud Deployment Manager

In this hands-on lab, we will introduce ourselves to working with Google Cloud Deployment Manager. We will start with a simple single-VM deployment, move on to a more complex deployment with multiple dependencies, and finish by deploying a group of imported template configurations in a single deployment.

Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 1h 0m
Published
Clock icon Mar 31, 2019

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Download configuration files used for this lab

    We will perform the majority of our activities in Cloud Shell.

    • From the web console, open Cloud Shell from the top-right

    • Download the configuration files we will use for this lab by copy/pasting the following command:

        gsutil -m cp -r gs://acg-gcp-labs-resources/deployment-manager-basic/* .
      

    Note: The period at the end of the command is required.

  2. Challenge

    Create your first single VM deployment

    Before we create our first deployment, we must first edit our configuration file to reflect the current project.

    • From Cloud Shell, open the editor window by clicking the pencil icon in the top-right.

    • In the new window that appears, click on vm-web.yaml.

    • In the vm-web.yaml file, change all (YOUR_PROJECT) fields to reflect your current project ID. There should be 2 total.

    • Make sure the changes are saved by going to File - Save from the Cloud Shell Editor menu.

    • Back in the command prompt, deploy your first deployment by typing the following:

        gcloud deployment-manager deployments create single-vm --config vm-web.yaml
      
    • Once the deployment completes, go to the web console and verify that a Compute Engine instance has been created. You should be able to click the external IP address to view its website.

    • Still in the web console, delete your deployment by going to the top-left menu > Deployment Manager. Select your deployment and click DELETE.

  3. Challenge

    Deploy complex deployment with dependencies

    We are now going to deploy a more complex deployment manager configuration that requires deploying resources in a certain order.

    • Back in the Cloud Shell Editor, select the file dependencies.yaml.

    • Under the resource for server-1, scroll down to the NetworkInterfaces properties and notice that the network and subnetwork have a reference field supplied. This tells Deployment Manager that deploying this instance depends on other resources in the same deployment being created first. You can view other dependencies throughout the rest of the config file.

    • As before, change all the '(YOUR_PROJECT)' fields to your current project ID. There are again two total, which you can find by the #CHANGE ME at the end of each affected line

      • Make sure the changes are saved by going to File - Save from the Cloud Shell Editor menu.
    • Back in command prompt, deploy this configuration by typing the following:

        gcloud deployment-manager deployments create vpcs --config dependencies.yaml
      
  4. Challenge

    View deployment manifest and delete deployment

    After deployment is complete, let's view the manifest:

    • Still in command prompt, view details of your deployment:

        gcloud deployment-manager deployments describe vpcs
      
    • Look for a field in the form of manifest-(TIMESTAMP). Copy this field.

    • Type in the following to view the full manifest, supplying the manifest ID you copied above:

        gcloud deployment-manager manifests describe manifest-(TIMESTAMP) --deployment vpcs
      
    • You can also view the same manifests in the web console > Deployment Manager.

    • Delete your deployment using the following command:

        gcloud deployment-manager deployments delete vpcs
      
  5. Challenge

    Create deployment with templates

    • In Cloud Shell, go to your templates directory:

        cd templates
      
    • In the Code Editor, view the template-config.yaml and the template .jinja files.

    • This time, we do not need to change the project ID because the template files are able to automatically resolve the current project ID.

    • Deploy your template-enabled configuration by typing:

        gcloud deployment-manager deployments create templates --config template-config.yaml
      
    • View results in web console, and attempt to open website via external IP.

    • Delete deployment using one of the methods above.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans