An infrastructure team needs to modify the service account assigned to a standalone production Compute Engine virtual machine to adhere to the principle of least privilege. The instance is currently running and associated with the default Compute Engine service account. Which sequence of actions should the Cloud Engineer take to attach a newly created custom service account to this existing virtual machine?
- Stop the virtual machine instance, execute the gcloud compute instances set-service-account command specifying the custom service account, and start the instance.Cevap
- BAssign the Owner primitive role directly to the existing default Compute Engine service account so that permission updates take effect without stopping the running instance.
- CReconfigure the Managed Instance Group autoscaling policy to dynamically swap the service account permissions across active instances while maintaining zero downtime.
- DConvert the virtual machine to a Spot VM instance type, which enables live service account credential rotation while the workload remains online.
Cevap
Stop the virtual machine instance, execute the gcloud compute instances set-service-account command specifying the custom service account, and start the instance.
To update the identity of an existing Compute Engine VM instance, the instance must first be stopped. Once in the TERMINATED state, the gcloud compute instances set-service-account command updates the associated service account. Starting the VM applies the change.
Adım Adım Çözüm
Anahtar Kavram
Modifying Compute Engine Service Accounts and Least Privilege Administration
Tahmini Süre:1m 30s