36

Ive read: https://cloud.google.com/compute/docs/instances/stopping-or-deleting-an-instance. In it they explain that:

You can stop an instance temporarily so you can come back to it at a later time. A stopped instance does not incur charges, but all of the resources that are attached to the instance will still be charged. Alternatively, if you are done using an instance, delete the instance and its resources to stop incurring charges.

However, i don't know how things are allocated in google cloud so im not sure what this means.

Say I stop my instance, I guess i am still using their storage, but im not using any CPU right? Does that mean that i will only pay for storage but not for the CPU and GPU hours?

Also how does google stop my instance? I know that if you suspend an instance in something like "Virtualbox" you can start it and start from when you left off. Is that what google does? Can I stop the instance halfway through running something and have it continue where it left off when i start the instance again?

Maxim
  • 4,075
  • 1
  • 14
  • 23
Qwertford
  • 1,039
  • 2
  • 14
  • 25

2 Answers2

43

When you stop your instance, you will not pay for CPU or GPU while the instance is stopped as the instance is not using them but you will be charged for resources attached as stated in the link you posted:

Your instances are not charged for per-second usage charges in TERMINATED state but any resources attached to the virtual machine will be charged until they are deleted, such as static IPs and persistent disks.

Google stops your instance by shutting it down, so you will lose data that is not in a persistent disk already.

From their docs:

When you shut down or delete an instance, Compute Engine sends the ACPI Power Off signal to the instance and waits a short period of time for your instance to shut down cleanly. If your instance is still running after this grace period, Compute Engine forcefully terminates it even if your shutdown script is still running.

There is a gcloud command that is in alpha that can suspend your VM: gcloud alpha compute instances suspend, you can read more in the docs here. It will only work on instances not using GPU or CSEK or preemptible VMs.

Nickson Thanda
  • 799
  • 7
  • 11
  • 3
    but what about the disks of the instance? do they incur charges just for being kept? – matanster Nov 11 '19 at 10:13
  • 2
    Persistent disks incur charges. However, if you have a local SSD and you shut down your instance then you do not incur charges for it but you will lose all data. – Nickson Thanda Jan 07 '20 at 12:24
  • 1
    What about the boot disk? That's persistent but it's not a *Persistent Disk* per se. Does it count as a chargeable resource? – Trevor May 02 '20 at 05:01
  • 1
    What about license fees? It seems they are still charged – Tofandel Jun 16 '20 at 18:34
  • I deleted the cloud SQL instance after 24 hours and still get charged and billing is rapidly increasing. Please see the details here: https://stackoverflow.com/questions/74496090/deleted-cloud-sql-instance-and-still-get-charged – Mussa Charles Nov 19 '22 at 03:38
2

Compute Engine documentation says:

A stopped instance does not incur charges, but all of the resources that are attached to the instance continue to incur charges. For example, you are charged for persistent disks and external IP addresses according to the price sheet, even if an instance is stopped. To stop being charged for attached resources, you can reconfigure a stopped instance to not use those resources, and then delete the resources.

Ronnie Royston
  • 16,778
  • 6
  • 77
  • 91