What is a resource definition in Google Cloud Platform (GCP)?
A resource definition in GCP describes a specific cloud service or component, like a virtual machine or storage bucket, including its properties and configuration.
Click to reveal answer
beginner
Name three common resource types you can define in GCP.
Compute Engine VM instances, Cloud Storage buckets, and Cloud Pub/Sub topics are common resource types in GCP.
Click to reveal answer
intermediate
Why is it important to define resources declaratively in GCP?
Declarative resource definitions let you specify the desired state of resources, making it easier to manage, automate, and reproduce infrastructure reliably.
Click to reveal answer
beginner
What file format is commonly used for defining GCP resources in Infrastructure as Code?
YAML or JSON files are commonly used to define GCP resources in Infrastructure as Code tools like Deployment Manager or Terraform.
Click to reveal answer
intermediate
How does GCP identify a resource uniquely?
GCP uses a resource name and a unique identifier within a project and region or zone to uniquely identify each resource.
Click to reveal answer
Which of the following is NOT a typical GCP resource?
ACloud Pub/Sub topic
BCloud Storage bucket
CCompute Engine VM instance
DLocal desktop folder
✗ Incorrect
Local desktop folders are not managed resources in GCP; the others are common GCP resources.
What is the main benefit of defining resources declaratively in GCP?
AManual configuration is faster
BIt only works for storage resources
CIt allows specifying the desired state for automation
DIt requires no permissions
✗ Incorrect
Declarative definitions specify the desired state, enabling automation and consistent management.
Which file formats are commonly used for GCP resource definitions?
AYAML and JSON
BXML and CSV
CTXT and DOCX
DHTML and CSS
✗ Incorrect
YAML and JSON are standard formats for defining infrastructure resources.
In GCP, what uniquely identifies a resource?
AOnly the resource name
BResource name and project ID
CUser email address
DOperating system version
✗ Incorrect
Resources are uniquely identified by their name combined with the project and location.
Which GCP service is used to manage resource definitions declaratively?
ACloud Deployment Manager
BCloud Functions
CBigQuery
DCloud Run
✗ Incorrect
Cloud Deployment Manager allows declarative resource management using configuration files.
Explain what a resource definition is in GCP and why it is useful.
Think about how you tell GCP what you want to create and manage.
You got /3 concepts.
Describe how GCP uniquely identifies resources and why this is important.
Consider how GCP keeps track of many resources without confusion.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of a resource definition in Google Cloud Platform (GCP)?
easy
A. To manually start and stop virtual machines
B. To write application code that runs on GCP
C. To monitor the usage of cloud resources
D. To tell GCP what cloud parts to create and how to configure them
Solution
Step 1: Understand the role of resource definitions
Resource definitions specify what cloud resources to create and their settings.
Step 2: Compare options to the definition role
Only To tell GCP what cloud parts to create and how to configure them describes creating and configuring cloud parts, which matches resource definitions.
Final Answer:
To tell GCP what cloud parts to create and how to configure them -> Option D
Quick Check:
Resource definitions = create and configure cloud parts [OK]
Hint: Resource definitions describe cloud parts to create [OK]
Common Mistakes:
Confusing resource definitions with application code
Thinking resource definitions monitor usage
Believing resource definitions manually control VMs
2. Which of the following is the correct minimal structure for a GCP resource definition in YAML?
easy
A. resources:\n - name: my-vm\n type: compute.instance\n properties:\n location: us-central1-a
B. resources:\n - id: my-vm\n kind: compute.v1.instance\n settings:\n zone: us-central1-a
C. resources:\n - name: my-vm\n type: compute.v1.instance\n properties:\n zone: us-central1-a
D. resource_list:\n - name: my-vm\n type: compute.v1.instance\n properties:\n zone: us-central1-a
Solution
Step 1: Check the required keys in GCP resource definitions
GCP expects 'resources' list with each item having 'name', 'type', and 'properties'.
Step 2: Validate each option
resources:\n - name: my-vm\n type: compute.v1.instance\n properties:\n zone: us-central1-a uses correct keys and valid type 'compute.v1.instance'. Others use wrong keys like 'id', 'kind', or wrong root key 'resource_list'. resources:\n - name: my-vm\n type: compute.instance\n properties:\n location: us-central1-a uses incorrect type 'compute.instance'.
Hint: Resource names must be unique in definitions [OK]
Common Mistakes:
Ignoring duplicate names
Thinking storageClass values are invalid
Believing location is disallowed
5. You want to define a GCP resource that creates a Compute Engine VM with a specific network interface and a startup script. Which of the following resource definitions correctly includes both properties?