How to stop an instance of a compute instance without terminating the instance?

I play with the Google Compute Engine with debian as the source image. I understand that I will pay an hour until the instance is running, regardless of whether I enter ssh or not. The shutdown -h command seems to put the instance in shutdown mode, and I will need to instantiate the next time.

My question is: how do I just shut down a virtual machine without interrupting it? is this an option?

Google Say that: https://developers.google.com/compute/docs/troubleshooting If you disconnect your instance using sudo shutdown or sudo poweroff, this is the equivalent of ending it. It is not possible to freeze an instance and restart it later. You must recreate your instance if you decide to close it. When an instance is closed from the inside, it enters the TERMINATED state, but will still be displayed in the API (for example, when you specify instances). To remove it from the list, you must explicitly delete the instance. However, the runtime for the TERMINATED instance is not set.

+7
google-compute-engine
source share
6 answers

My question is: how do I just shut down a virtual machine without interrupting it? is this an option?

Sorry, you canโ€™t. AWS EC2 is an exception when it comes to saving instances at shutdown. Even OpenStack vendors do not support this. The workaround is to create an image based on the snapshot you want, and then create a new instance based on this image.

+5
source share

I know that this thread is a bit outdated, but the Shutdown/Start function appeared in the developer console and on the command line, so you no longer need to create snapshots.

Documentation is available here.

+13
source share

You can stop the instance in any of the following ways:

See docs for more details, including how it affects resources and what actions you can take on a stopped instance.

In the corresponding note, see also the documents for restarting a stopped instance .

+7
source share

What you can do is save all the data on your hard drive, then turn it off and next time create an instance with the same drive.

Shutting down from the web console using:

 Compute Engine > VM INSTANCES > Click on engine name > Delete 

there is a flag:

 Also delete boot disk "instance0" 

If you leave it unchecked, the next time you create another instance for the project, you can choose:

 Boot source > Existing persistent disk 

And then:

 Source disk > Name of project 

And your old drive will be intact.

Removing an instance in this way removed it from the list of instances for me, while poweroff did not remove it immediately.

Beware: persistent storage used for disks has a (relatively small) monthly cost. I received a few cents for some unused data without warning email.

+6
source share

In addition to the rdodev point, you can also detach a permanent drive. When starting another instance, you can configure the previous configuration when running the script. Not exactly the same, but an alternative.

0
source share

The closest solution is to delete the instance, rather than delete the permanent drive. When you need to restart the instance, just create a new one with this drive. You can select an instance with the same characteristics or different characteristics. It does not matter.

0
source share

All Articles