Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Custom VPC creation
📖 Scenario: You are setting up a new Google Cloud environment for a small company. They want a custom Virtual Private Cloud (VPC) network to control their cloud resources and traffic.
🎯 Goal: Create a custom VPC network with one subnet in a specific region. This network will be the foundation for deploying cloud resources securely.
📋 What You'll Learn
Create a custom VPC network named custom-vpc
Add a subnet named custom-subnet in the us-central1 region
Set the subnet IP range to 10.0.0.0/24
Ensure the VPC is set to custom subnet mode
💡 Why This Matters
🌍 Real World
Custom VPCs let companies control their cloud network layout, improving security and traffic management.
💼 Career
Cloud engineers often create and manage VPCs to isolate resources and meet organizational policies.
Progress0 / 4 steps
1
Create a custom VPC network
Create a variable called network_name and set it to the string custom-vpc.
GCP
Hint
Use quotes around the network name string.
2
Define the subnet configuration
Create a dictionary called subnet_config with keys name, region, and ip_cidr_range. Set their values to custom-subnet, us-central1, and 10.0.0.0/24 respectively.
GCP
Hint
Use curly braces to create the dictionary and separate keys and values with colons.
3
Create the VPC network configuration
Create a dictionary called vpc_config with keys name, auto_create_subnetworks, and subnetworks. Set name to network_name, auto_create_subnetworks to False, and subnetworks to a list containing subnet_config.
GCP
Hint
Remember to use the variable network_name for the name key and put subnet_config inside a list for subnetworks.
4
Add the final VPC creation command
Create a dictionary called create_vpc_request with a single key network set to vpc_config.
GCP
Hint
This dictionary represents the final request to create the VPC network.
Practice
(1/5)
1. What is the main advantage of creating a Custom VPC in Google Cloud Platform?
easy
A. You can define your own IP address ranges and subnets.
B. It automatically creates default firewall rules.
C. It provides free internet access without configuration.
D. It disables all network traffic by default.
Solution
Step 1: Understand Custom VPC purpose
A Custom VPC allows you to design your network with your own IP ranges and subnets, unlike default VPCs which have preset ranges.
Step 2: Eliminate wrong options
Custom VPC does not disable traffic, default firewall rules exist regardless, free internet requires configuration.
Final Answer:
You can define your own IP address ranges and subnets. -> Option A
Quick Check:
Custom VPC = Custom IP ranges [OK]
Hint: Custom VPC means you pick your IP ranges [OK]
Common Mistakes:
Confusing default VPC with custom VPC
Thinking firewall rules are auto-created
Assuming internet access is automatic
2. Which gcloud command correctly creates a custom VPC named my-vpc with no automatic subnet creation?
easy
A. gcloud compute networks create my-vpc --subnet-mode=auto
B. gcloud compute networks create my-vpc --auto-create-subnetworks
C. gcloud compute networks create my-vpc --no-subnet-mode
D. gcloud compute networks create my-vpc --subnet-mode=custom
Solution
Step 1: Identify subnet mode for custom VPC
Custom VPC requires the flag --subnet-mode=custom to avoid automatic subnet creation.
Step 2: Evaluate options
--subnet-mode=auto creates automatic subnets. --auto-create-subnetworks uses invalid syntax. --no-subnet-mode does not exist.
Final Answer:
gcloud compute networks create my-vpc --subnet-mode=custom -> Option D
Quick Check:
Custom VPC uses --subnet-mode=custom [OK]
Hint: Use --subnet-mode=custom to create custom VPC [OK]
Hint: Check subnet CIDR overlaps before creating [OK]
Common Mistakes:
Assuming region is invalid without checking
Confusing network creation flags with subnet flags
Ignoring existing subnet CIDR ranges
5. You want to create a custom VPC named prod-vpc with two subnets: - subnet-a in us-west1 with range 10.10.1.0/24 - subnet-b in us-east1 with range 10.10.2.0/24 Which sequence of gcloud commands correctly creates this setup?