An operations engineer needs to expand the primary IPv4 address range of an existing custom subnet named `prod-subnet-us-east` located in region `us-east1` from to without disrupting existing workloads running in the Virtual Private Cloud (VPC). Which `gcloud` command should the engineer execute to perform this operation?
- `gcloud compute networks subnets expand-ip-range prod-subnet-us-east --prefix-length=23 --region=us-east1`Answer
- B`gcloud compute networks create prod-subnet-us-east --subnet-mode=custom --range=10.1.0.0/23`
- C`gcloud compute firewall-rules update prod-subnet-us-east --priority=23`
- D`gcloud compute instances update prod-subnet-us-east --zone=us-east1-a --network=corp-vpc`
Answer
The command `gcloud compute networks subnets expand-ip-range prod-subnet-us-east --prefix-length=23 --region=us-east1` expands the IP address range of an existing subnet dynamically.
To expand the IP address range of an existing Google Cloud VPC subnet, you use the command `gcloud compute networks subnets expand-ip-range [SUBNET_NAME]` with the `--prefix-length` flag indicating the new (smaller numerical prefix) subnet mask. This operation is non-disruptive and allows expanding a subnet range (e.g., from to ).
Step-by-Step Solution
Key Concept
VPC Subnet IP Address Expansion
Estimated Time:1m 15s