A cloud engineer needs to deploy a new Compute Engine virtual machine instance that relies on a custom OS image stored in a separate centralized image-repository project. The VM must be assigned a reserved static internal IP address within a specific subnet and execute an automated initialization script upon first boot. What is the correct sequence of steps required to prepare resources, deploy the instance, and verify startup execution?
- 1Grant the Compute Image User role (roles/compute.imageUser) on the source image project to the service account or identity performing the deployment.
- 2Reserve a static internal IP address in the target VPC network subnet using gcloud compute addresses create.
- 3Execute gcloud compute instances create, specifying the cross-project image family/name, target subnet, reserved internal IP, and startup script metadata.
- 4Inspect the instance startup logs using gcloud compute instances get-serial-port-output to verify successful startup script execution.
Answer
The correct workflow requires establishing cross-project IAM permissions (granting compute.imageUser on the source project), reserving the static internal IP address in the target subnet, executing the instance creation command with the specified parameters, and finally verifying startup script execution via the serial port output.
Deploying a Compute Engine instance with cross-project dependencies and reserved networking requires completing IAM authorization and network resource allocation first. Granting roles/compute.imageUser on the source image project ensures permission to read the image. Reserving the static internal IP address in the target subnet ensures the network resource is allocated. After these prerequisites are met, running gcloud compute instances create provisions the VM with the reserved IP and startup script. Finally, checking serial port output allows post-boot verification of the initialization process.
Step-by-Step Solution
Key Concept
Cross-Project Compute Engine VM Provisioning and Initialization Workflow