You are managing Compute Engine resources and need to create a custom image from an existing virtual machine's boot disk and use it to deploy a new virtual machine instance. What is the correct sequence of steps to safely perform this operation?
- 1Stop the running source virtual machine instance to ensure file system consistency.
- 2Create a custom image specifying the source boot disk of the stopped instance using `gcloud compute images create`.
- 3Deploy a new virtual machine instance specifying the custom image as the boot disk with `gcloud compute instances create`.
- 4Start the original source virtual machine instance to restore its normal operations.
Answer
The correct order of operations is: Stop the running source instance -> Create the custom image from the boot disk -> Deploy the new instance using the custom image -> Restart the source instance.
To create a consistent custom image from a Compute Engine boot disk, the source virtual machine should first be stopped. After the VM stops, the image is created from its boot disk. The new VM instance is then provisioned from the created custom image, and finally the original source VM is restarted.
Step-by-Step Solution
Key Concept
Custom Image Creation and VM Provisioning Workflow