Google Associate Cloud Engineer Question 263
Single answerGoogle Cloud PlatformYou are a cloud engineer tasked with adding a new subnet to an existing Virtual Private Cloud (VPC) in Google Cloud Platform. The VPC is named 'prod-vpc' and is currently configured with a subnet in the 'us-central1' region. You need to add a subnet in the 'us-east1' region with the IP address range '10.1.2.0/24'. Which of the following steps should you follow to complete this task?
- A
Navigate to the VPC network page in the Google Cloud Console, select 'prod-vpc', and click on 'Add subnet'. Enter 'us-east1' as the region and '10.1.2.0/24' as the IP range.
- B
Use the gcloud command line tool with the command: gcloud compute networks subnets create 'subnet-us-east1' --network 'prod-vpc' --region 'us-east1' --range '10.1.2.0/24'.
- C
Add a new subnet by editing the 'prod-vpc' network configuration file in Cloud Shell and applying the changes.
- D
Create a new VPC named 'prod-vpc-us-east1' in the 'us-east1' region and configure it with the IP range '10.1.2.0/24'.
Show answer and explanation
Correct answer: B
Explanation
To add a subnet to an existing VPC in Google Cloud Platform, you can use the gcloud command line tool. The appropriate command involves specifying the name of the subnet, the VPC network, the region, and the IP address range. This approach allows for precise control over the subnet configuration and is suitable for scenarios where command-line operations are preferred.
- A. Incorrect.
This option describes the correct procedure using the Google Cloud Console interface, but the question specifies using the command-line tool.
- B. Correct.
This option correctly describes using the gcloud command line tool to add a new subnet to an existing VPC, which is the required method in this scenario.
- C. Incorrect.
Editing a network configuration file directly in Cloud Shell is not a standard method for adding subnets in GCP.
- D. Incorrect.
Creating a new VPC is not necessary; the task is to add a subnet to an existing VPC, not to create a separate network.