An engineer needs to resize a standalone Compute Engine virtual machine instance named `db-primary` to a larger machine type (`e2-standard-8`) to handle increased workload demand. The instance is currently in the RUNNING state and has a persistent disk attached. Which process must be used to successfully modify the machine type of this VM instance?
- Stop the VM instance, execute `gcloud compute instances set-machine-type db-primary --machine-type=e2-standard-8`, and start the VM instance.Answer
- BExecute `gcloud compute instances set-machine-type db-primary --machine-type=e2-standard-8` directly while the VM is in the RUNNING state to update vCPU and memory without downtime.
- CChange the VM provisioning model to a Spot VM so that Google Cloud automatically scales up vCPU and RAM resources during high workload demand.
- DSubmit a Compute Engine resource quota increase request to allow live modification of running VM machine types.
Answer
The correct action is to stop the VM instance, change the machine type using `gcloud compute instances set-machine-type`, and then start the VM instance.
To modify the machine type (vCPU and RAM) of an unmanaged or standalone Compute Engine VM instance, the instance must first be stopped. Once in the TERMINATED state, running `gcloud compute instances set-machine-type` reconfigures the VM attributes. Restarting the instance brings it back online with the requested compute resources.
Step-by-Step Solution
Key Concept
Modifying Compute Engine Instance Machine Types
Estimated Time:1m 30s