Capture an image from a virtual machine
Capture a prepared virtual machine as a reusable image, find it in the creation wizard, and delete images that you no longer need.
Capture an instance as an image to launch new instances with the same operating system, software, and settings. Prepare the instance first, then capture it, and select the image in the creation wizard.
Before you begin
- You need the Owner or Contributor role, or a custom role with Manage access to Compute / Instances, on the subscription or on the project.
- Prepare the instance: install and configure the software that every new instance needs, and remove data that new instances shouldn't get, such as credentials and logs.
- Plan for consistency. The platform doesn't stop the instance to capture it. For a consistent image, stop the applications that write to the disks first.
Capture the image
In the console, go to ComputeInstances, and select the instance.
Open the More actions menu (⋯), and select Capture image.
Under What you want back, keep Reusable image.
In Name, enter a name for the image, and optionally a Description.
Select the image's Operating system and Architecture.
Select Capture.
You can also start from the instance list: open the actions menu (⋯) at the end of the instance's row, and select Capture image.
| Field | Rules |
|---|---|
| Name | 3–63 characters: lowercase letters, numbers, dots, and hyphens. It starts and ends with a letter or a number. No other image can have the same name. |
| Description | Optional. |
| Operating system | The operating system on the instance. It's recorded with the image. |
| Architecture | x86_64 or arm64. It's recorded with the image. |
What happens next
The console returns to the instance page, and the image is created in the background. The capture copies every disk attached to the instance: the OS disk and the data disks.
When the image is ready, it appears in the image list of the creation wizard, marked Your project. To launch instances from it, see Launch virtual machines from an image.
If the name is already taken, the capture is refused with "image name already exists", and nothing is created. Enter another name.
What an image keeps in use
The cloud keeps the copies of the instance's disks as volume snapshots for as long as the image exists. While the image exists:
- The instance's volumes can't be deleted. Deleting one fails with a message that the volume still has dependent snapshots in the cloud.
- If you delete the instance together with its OS disk, the instance is deleted, but the OS disk stays in Block Storage with the status Error, and it keeps being billed.
To free those volumes, delete the image first.
Delete an image
Deleting an image is available through the API only. Use DELETE/scopes/{scopeId}/compute/images/{imageId}. The request is refused when:
- The image is still being captured. Wait until the capture finishes or fails.
- Instances that were created from the image still exist, including instances in other projects of your tenant. The refusal lists their IDs.
- The image comes from the region's catalog. Only images of your tenant can be deleted.
Deleting an image also deletes the copies of the disks that it holds, and it can't be undone.
Create an image from a volume snapshot
Building an image from a volume snapshot is available through the API only. Use POST/scopes/{scopeId}/compute/images with sourceKind set to snapshot. The snapshot must be Available and in the same project. The platform creates a temporary volume from the snapshot, uploads it as the image, and deletes the temporary volume.
Billing
The capture page shows the rate. For how images are billed, see Billing.