0
0
GCPcloud~30 mins

Resource definitions for GCP - Mini Project: Build & Apply

Choose your learning style9 modes available
Resource definitions for GCP
📖 Scenario: You are setting up a simple Google Cloud Platform (GCP) project. You need to define resources like a Compute Engine instance and a Cloud Storage bucket using configuration files.
🎯 Goal: Build a basic GCP resource definition using configuration files that create a virtual machine and a storage bucket.
📋 What You'll Learn
Create a resource definition for a Compute Engine instance named vm-instance-1 in zone us-central1-a.
Create a resource definition for a Cloud Storage bucket named my-storage-bucket-123 in location US.
Add a configuration variable for the machine type of the Compute Engine instance.
Use the machine type variable in the Compute Engine instance resource definition.
💡 Why This Matters
🌍 Real World
Defining resources in GCP using configuration files is a common task for automating cloud infrastructure setup.
💼 Career
Cloud engineers and DevOps professionals use resource definitions to manage infrastructure as code, enabling repeatable and consistent deployments.
Progress0 / 4 steps
1
Create initial resource definitions
Create a YAML resource definition for a Compute Engine instance named vm-instance-1 in zone us-central1-a. Use the resource type compute.v1.instance, name it vm-instance-1, and set the zone property exactly as specified.
GCP
Need a hint?

Remember to use the exact resource type compute.v1.instance, name the resource vm-instance-1, and set the zone property inside properties.

2
Add a Cloud Storage bucket resource
Add a resource definition for a Cloud Storage bucket named my-storage-bucket-123 in location US. Use the resource type storage.v1.bucket and set the name and location properties exactly as specified.
GCP
Need a hint?

Use the resource type storage.v1.bucket and set the name and location properties inside properties.

3
Add a machine type configuration variable
Create a configuration variable called machineType and set its value to zones/us-central1-a/machineTypes/n1-standard-1. This variable will be used to specify the machine type of the Compute Engine instance.
GCP
Need a hint?

Define a variables section at the top level and add machineType: zones/us-central1-a/machineTypes/n1-standard-1 inside it.

4
Use the machine type variable in the Compute Engine instance
Update the Compute Engine instance resource to use the machineType variable for its machineType property. Use the syntax $(machineType) to reference the variable.
GCP
Need a hint?

Add the machineType property inside the Compute Engine instance's properties and set it to $(machineType).