I'd like to use a GCE server and VNC to run some desktop programs I've written. However, I'd like to not have the GCE server running all the time (to save money) and I'd like to have the setup of my VNC desktop persisted (to save time). It seems like the easiest way to accomplish this is to somehow hibernate the GCE instance. Is there a way to do this either from a script or from the command line?
A stopped instance does not incur charges, but all of the resources that are attached to the instance will still be charged. For example, you are charged for persistent disks and external IP addresses according to the price sheet, even if an instance is stopped.
Google App Engine is a Platform as a Service (PaaS) solution that makes deployment easier. On the other hand, the Google Compute Engine is an Infrastructure as a Service (IaaS) tool.
The only currently supported technique that I'm aware of would be to use a bootable persistent disk, which outlives the virtual machine so you could delete and restart the VM with moderately quick (under 30s) startup time but I don't think that would meet your needs because unless your app has built-in, robust checkpoint/resume logic, you might not be able to pick up where you left off on the desktop.
Another way to approach this would be to use a lightweight container, like Docker, which has suspend/resume and checkpointing built into its design. You can't currently run Docker containers on Google Compute Engine but we're interested in exploring the potential of Docker on GCE so stay tuned.
Sounds like what you'd really like is a native suspend capability with near instantaneous resume and no or very low charge for VMs in the suspended state. I think that's an interesting idea - I've submittted an internal feature request to the Compute Engine engineering team for future consideration.
Compute Engine has alpha support for suspending virtual machines. A quote from that documentation:
gcloud alpha compute instances suspend
is used to suspend a Google Compute Engine virtual machine. Suspending a VM is the equivalent of sleep or standby mode: the guest receives an ACPI S3 suspend signal, after which all VM state is saved to temporary storage. An instance can only be suspended while it is in the RUNNING state. A suspended instance will be put in SUSPENDED state.
The command is not yet available in the Compute Engine web UI but can be invoked from the command line like:
gcloud alpha compute instances suspend my-vm
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