A cloud engineer needs to deploy a mission-critical database virtual machine named `prod-db-01` in zone `us-east4-a` using the `gcloud` CLI. To protect the workload against accidental deletion through the Google Cloud Console or CLI, deletion protection must be enabled on the instance. Furthermore, the boot disk must be retained if the VM is ever deleted in the future. Which `gcloud compute instances create` command should the engineer execute?
- gcloud compute instances create prod-db-01 --zone=us-east4-a --deletion-protection --no-auto-delete-boot-diskAnswer
- Bgcloud compute instances create prod-db-01 --zone=us-east4-a --prevent-destroy --auto-delete-boot-disk=false
- Cgcloud compute instances create prod-db-01 --zone=us-east4-a --provisioning-model=SPOT --no-auto-delete-boot-disk
- Dgcloud compute instances create prod-db-01 --zone=us-east4-a --deletion-protection --scopes=roles/owner
Answer
The command using `gcloud compute instances create prod-db-01 --zone=us-east4-a --deletion-protection --no-auto-delete-boot-disk` correctly enables deletion protection and ensures the boot disk is preserved.
The correct command specifies `--deletion-protection` to guard the instance against accidental removal API calls and `--no-auto-delete-boot-disk` to preserve the persistent boot disk if the instance is eventually deleted.
Step-by-Step Solution
Key Concept
Compute Engine gcloud flags for deletion protection and boot disk retention policy