Reputation: 2052
I have a VM which is up and running and I have few applications in the VM. So I want to have an image of this VM so that I can create new instances with all the installed packages. I have option called clone, but instead cloning a VM I wanted to have it as an Image and create VM whenever I want.
Upvotes: 7
Views: 12217
Reputation: 160
https://github.com/khushbuparakh/gcp/blob/master/instance.py
You can use this. It creates a bucket. Upload your private file to the bucket. Create an image using that file and spin up an instance. Make sure the file you are uploading to bucket is in tar.gz compressed format with a disk.raw file in it.
Upvotes: -2
Reputation: 2725
It's described here: https://cloud.google.com/compute/docs/creating-custom-image
Basically what it boils down to:
gcloud compute images create example-image --source-disk example-disk --source-disk-zone ZONE
Upvotes: 12