Bird
Raised Fist0
GCPcloud~10 mins

Deployment Manager as native IaC in GCP - Interactive Code Practice

Choose your learning style10 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the type of resource in Deployment Manager.

GCP
resources:
- name: my-vm
  type: [1]
Drag options to blanks, or click blank then click option'
Apubsub.v1.topic
Bstorage.v1.bucket
Ccompute.v1.instance
Dsqladmin.v1.instance
Attempts:
3 left
💡 Hint
Common Mistakes
Using a storage bucket type instead of a VM instance type.
Confusing SQL instance type with compute instance type.
2fill in blank
medium

Complete the code to set the machine type for the VM instance.

GCP
resources:
- name: my-vm
  type: compute.v1.instance
  properties:
    zone: us-central1-a
    machineType: [1]
Drag options to blanks, or click blank then click option'
An1-standard-1
Bzones/us-central1-a/machineTypes/n1-standard-1
Czones/us-central1-a/instances/n1-standard-1
DmachineTypes/n1-standard-1
Attempts:
3 left
💡 Hint
Common Mistakes
Using only the machine type name without zone path.
Confusing instance name with machine type.
3fill in blank
hard

Fix the error in the YAML to correctly define the disk size property.

GCP
resources:
- name: my-vm
  type: compute.v1.instance
  properties:
    disks:
    - deviceName: boot
      type: PERSISTENT
      boot: true
      autoDelete: true
      initializeParams:
        diskSizeGb: [1]
Drag options to blanks, or click blank then click option'
A10
B10GB
C'10GB'
D'10'
Attempts:
3 left
💡 Hint
Common Mistakes
Adding units like 'GB' to the disk size value.
Using quotes around the number causing it to be a string.
4fill in blank
hard

Fill both blanks to define a firewall rule allowing TCP port 80.

GCP
resources:
- name: allow-http
  type: compute.v1.firewall
  properties:
    network: [1]
    allowed:
    - IPProtocol: [2]
      ports:
      - '80'
Drag options to blanks, or click blank then click option'
Aglobal/networks/default
Btcp
Cdefault
Dudp
Attempts:
3 left
💡 Hint
Common Mistakes
Using just 'default' instead of full network path.
Using UDP instead of TCP for HTTP traffic.
5fill in blank
hard

Fill all three blanks to create a metadata entry with key 'startup-script' and a simple echo command.

GCP
resources:
- name: my-vm
  type: compute.v1.instance
  properties:
    metadata:
      items:
      - key: [1]
        value: [2]
      - key: [3]
        value: 'ignored'
Drag options to blanks, or click blank then click option'
A'startup-script'
B'#!/bin/bash\necho Hello World'
C'shutdown-script'
D'echo Hello World'
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting quotes around keys and values.
Using incorrect keys for metadata entries.

Practice

(1/5)
1. What is the main purpose of Google Cloud Deployment Manager?
easy
A. To define and manage cloud resources using code
B. To manually create resources through the console
C. To monitor cloud resource usage in real-time
D. To provide a graphical interface for cloud billing

Solution

  1. Step 1: Understand Deployment Manager's role

    Deployment Manager lets you write code to define cloud resources instead of manual setup.
  2. Step 2: Compare options

    Only To define and manage cloud resources using code describes defining and managing resources using code, which matches Deployment Manager's purpose.
  3. Final Answer:

    To define and manage cloud resources using code -> Option A
  4. Quick Check:

    Deployment Manager = Infrastructure as Code [OK]
Hint: Deployment Manager = write code for cloud setup [OK]
Common Mistakes:
  • Confusing Deployment Manager with monitoring tools
  • Thinking it is a manual console tool
  • Mixing it with billing or cost tools
2. Which of the following is the correct way to start a Deployment Manager YAML configuration file?
easy
A. services:
B. resources:
C. instances:
D. deployments:

Solution

  1. Step 1: Recall YAML structure for Deployment Manager

    The root key to list cloud resources is resources:.
  2. Step 2: Check other options

    Options like deployments:, instances:, and services: are not valid root keys in Deployment Manager YAML.
  3. Final Answer:

    resources: -> Option B
  4. Quick Check:

    YAML starts with resources: [OK]
Hint: Deployment Manager YAML always starts with resources: [OK]
Common Mistakes:
  • Using wrong root keys like deployments or instances
  • Confusing resource types with YAML structure
  • Starting with service names instead of resources
3. Given this Deployment Manager snippet:
resources:
- name: my-vm
  type: compute.v1.instance
  properties:
    zone: us-central1-a
    machineType: zones/us-central1-a/machineTypes/n1-standard-1

What resource is being created?
medium
A. A network firewall rule
B. A storage bucket in us-central1-a
C. A SQL database instance
D. A virtual machine instance in zone us-central1-a

Solution

  1. Step 1: Identify resource type

    The type compute.v1.instance means a virtual machine (VM) instance.
  2. Step 2: Check properties

    The zone and machineType confirm it's a VM in zone us-central1-a with a standard machine type.
  3. Final Answer:

    A virtual machine instance in zone us-central1-a -> Option D
  4. Quick Check:

    compute.v1.instance = VM instance [OK]
Hint: compute.v1.instance means VM instance [OK]
Common Mistakes:
  • Confusing instance with storage or database
  • Ignoring the type field
  • Assuming default zone without checking properties
4. You wrote this Deployment Manager YAML:
resources:
- name: my-vm
  type: compute.v1.instance
  properties:
    zone: us-central1-a
    machineType: n1-standard-1

Why does deployment fail?
medium
A. name property cannot be my-vm
B. zone property is invalid
C. machineType property is missing zone prefix
D. type compute.v1.instance is deprecated

Solution

  1. Step 1: Check machineType format

    machineType must include full path with zone prefix like zones/us-central1-a/machineTypes/n1-standard-1.
  2. Step 2: Validate other fields

    zone is valid, name is allowed, and type is current. Only machineType format is wrong.
  3. Final Answer:

    machineType property is missing zone prefix -> Option C
  4. Quick Check:

    machineType needs full path [OK]
Hint: machineType needs full zone path like zones/zone/machineTypes/type [OK]
Common Mistakes:
  • Using short machineType without zone prefix
  • Changing name to fix error
  • Assuming type is deprecated
5. You want to create two VM instances in Deployment Manager using one YAML file. Which approach is best?
hard
A. List two separate resource entries under resources with different names
B. Create one resource with two names separated by commas
C. Use a loop inside YAML to repeat the resource
D. Write two separate YAML files and deploy them separately

Solution

  1. Step 1: Understand YAML resource listing

    Deployment Manager YAML supports multiple resources by listing each with a unique name under resources:.
  2. Step 2: Evaluate options

    List two separate resource entries under resources with different names correctly lists two resources separately. Create one resource with two names separated by commas is invalid syntax. Use a loop inside YAML to repeat the resource is not supported natively in YAML. Write two separate YAML files and deploy them separately works but is less efficient and not best practice.
  3. Final Answer:

    List two separate resource entries under resources with different names -> Option A
  4. Quick Check:

    Multiple resources = multiple entries [OK]
Hint: Multiple resources = multiple entries under resources: [OK]
Common Mistakes:
  • Trying to name one resource with multiple names
  • Expecting loops inside YAML
  • Splitting into multiple files unnecessarily
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard