Create Virtual Machine Instance from Snapshot in Google Cloud

Quick Tip

Normally we replicate VM Instances in Compute Engine by using Images but we can also use a Snapshot as a source for the boot disk of a new instance on the Google Cloud Platform.

Create Instance from Snapshot (Console)

Login to your Google Cloud Console and select your project.
Create your instance as normally but this time select your Snapshot as the boot disk:

On Google Cloud Platform - Compute Engine - VM Instances - Create Instance

  • Name: patovm
  • Type: n1-standard-1 (1 vCPU, 3.75 GB memory)
  • Boot disk:
    • Snapshots
      • Snapshot: snapvm
      • Standard persistent disk: 10GB
  • Identity and API access
    • Access scopes: Set access for each API
      • Compute Engine: Read Write
      • Storage: Full
  • Networking
    • Hostname: patovm.personal

and click Create

Create Instance from Snapshot (Cloud Shell)

First restore the Snapshot into a Disk:

$ gcloud compute disks create patovm \
--source-snapshot snapvm \
--type pd-standard \
--size 10 \
--zone us-central1-a

Created [https://www.googleapis.com/compute/v1/projects/personal-20202/zones/us-central1-a/disks/patovm].
NAME       ZONE           SIZE_GB  TYPE         STATUS
patovm     us-central1-a  10       pd-standard  READY

then create the instance using the new disk as boot:

$ gcloud compute instances create patovm \
--machine-type=n1-standard-1 \
--disk=name=patovm,device-name=patovm,mode=rw,boot=yes,auto-delete=yes \
--scopes=https://www.googleapis.com/auth/compute,https://www.googleapis.com/auth/devstorage.full_control \
--hostname patovm.personal \
--zone=us-central1-a

Created [https://www.googleapis.com/compute/v1/projects/personal-20202/zones/us-central1-a/instances/patovm].
NAME    ZONE           MACHINE_TYPE   PREEMPTIBLE  INTERNAL_IP  EXTERNAL_IP     STATUS
patovm  us-central1-a  n1-standard-1               10.128.0.17  35.225.239.157  RUNNING