A Systems Administrator needs to create a standardized golden image from an existing, configured Compute Engine instance named `web-template-vm` located in GCP project `corp-base-images`. The administrator must then use this custom image to provision a new production Compute Engine instance in a separate project named `corp-prod-apps`. In what correct chronological order should the administrator perform the steps to complete this cross-project image creation and VM deployment workflow?
- 1Stop the reference Compute Engine instance `web-template-vm` in `corp-base-images` to ensure persistent disk data consistency.
- 2Create a custom Compute Engine image from the boot disk of `web-template-vm` within `corp-base-images`.
- 3Grant the Compute Engine Service Agent or deployer service account in `corp-prod-apps` the Compute Image User (`roles/compute.imageUser`) IAM role on the custom image in `corp-base-images`.
- 4Run `gcloud compute instances create` in `corp-prod-apps`, specifying the custom image name and setting `--image-project=corp-base-images`.
Cevap
The correct sequence is: First, stop the reference Compute Engine instance to ensure disk consistency. Second, create the custom image from the boot disk. Third, grant the Compute Image User role on the image/project to the target project's identity. Fourth, execute the gcloud instance creation command in the target project referencing the image and image-project flags.
To deploy a Compute Engine VM from a custom image in a separate project, the source instance must first be stopped to guarantee disk state consistency. Next, the custom image is created from the source boot disk. Then, cross-project access must be configured by granting the Compute Image User role (roles/compute.imageUser) to the deploying identity or service account in the target project. Finally, the VM can be provisioned in the target project using the gcloud command with --image and --image-project specified.
Adım Adım Çözüm
Anahtar Kavram
Cross-Project Custom Image Creation and VM Provisioning