How can I download a google compute engine image that was created from a snapshot of a persistent disk? There doesn't seem to be a direct way to do this through the console.
In the Google Cloud console, go to the VM instances page. In the list of virtual machine instances, click SSH in the row of the instance that you want to connect to. After the connection is established, click the download icon download.
A machine image is a Compute Engine resource that stores all the configuration, metadata, permissions, and data from multiple disks of a virtual machine (VM) instance. You can use a machine image in many system maintenance, backup and recovery, and instance cloning scenarios.
There isn't a direct way to download a image or snapshot from GCE, but there's a way to save an image and store it in Google Cloud Storage(GCS) where it can be downloaded. You can use the standard gcimagebundle
tool to do this.
You can also create this image using the dd
command. On a temporary disk that’s bigger than the one you want to image, run this:
dd if=/dev/disk/by-id/google-diskname of=disk.img bs=5M
You can then run this command to copy it over to GCS:
gsutil cp disk.img gs://bucket/image.img
And later, you can:
gsutil cat gs://bucket/image.img | dd of=/dev/disk/by-id/google-newdisk bs=5M
This will allow you to make an image of your disk and then send it to GCS where you can download it using either the web interface or gsutil.
As an addition to the current answer, you can it directly download a file using SSH / SCP, by adding your public key to the "SSH Keys". Then, using your own terminal :
sheryl:~ sangprabo$ scp [email protected]:/var/www/my-file.tar.gz .
Enter passphrase for key '/Users/sangprabo/.ssh/id_rsa':
I prefer that way so I don't need to create a bucket first. CMIIW.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With