A system administrator needs to deploy a standard Compute Engine virtual machine instance named `analytics-db` in zone `us-central1-a` using the Google Cloud CLI. Due to third-party database software licensing rules tied to physical CPU sockets, the VM must be configured to terminate (stop) rather than live-migrate whenever Google performs host maintenance. Additionally, the instance must automatically restart if it crashes or if the host hardware fails unexpectedly. Which command should the administrator run to fulfill these requirements?
- gcloud compute instances create analytics-db --zone=us-central1-a --on-host-maintenance=TERMINATE --automatic-restartAnswer
- Bgcloud compute instances create analytics-db --zone=us-central1-a --on-host-maintenance=MIGRATE --no-automatic-restart
- Cgcloud compute instances create analytics-db --zone=us-central1-a --provisioning-model=SPOT --on-host-maintenance=TERMINATE
- Dgcloud compute instances create analytics-db --zone=us-central1-a --maintenance-policy=TERMINATE --restart-on-failure
Answer
Execute `gcloud compute instances create analytics-db --zone=us-central1-a --on-host-maintenance=TERMINATE --automatic-restart` to configure the instance to stop on maintenance events while allowing automatic restarts during unexpected host crashes.
The command containing `--on-host-maintenance=TERMINATE` and `--automatic-restart` accurately sets the scheduling policy to stop the instance during scheduled maintenance while enabling Compute Engine to restart the VM automatically if the host system crashes.
Step-by-Step Solution
Key Concept
Compute Engine Instance Scheduling Options and Maintenance Policies
Estimated Time:1m 15s