How to restore instance using snapshot in Google Compute Engine?

ε祈祈猫儿з 提交于 2019-12-22 08:57:36

问题


I created a snapshot of a VM instance via cloud console. I would like to know how I can restore an instance using a snapshot. The documentation for compute engine is not very helpful. The instance runs on Ubuntu. Thanks.


回答1:


To restore an instance from a snapshot without deleting/re-creating the instance:

  1. Shut down the instance and detach the boot disk: gcloud beta compute instances detach-disk INSTANCE_NAME --disk BOOT_DISK_NAME

  2. Create a new disk from the snapshot: gcloud compute disks create DISK_NAME --source-snapshot SNAPSHOT_NAME

  3. Attach the disk created from step 2 as the boot disk: gcloud beta compute instances attach-disk INSTANCE_NAME --disk DISK_NAME --boot

Restoring the instance without deleting/re-creating the instance means that after restore, the instance will keep its IP address and other properties like tags, labels, etc.




回答2:


Try using:

gcloud compute disks \
create <NEW_INSTANCE_NAME> \
--source-snapshot <SNAPSHOT_NAME> \
--type pd-ssd \
--zone <ZONE>

You could find useful instruction here.




回答3:


In Console, you can go to VM Instances from Compute Engine tab. There you click on '+Create Instance' and there in section of boot-disk, you can navigate to 'snapshots' tab and select the snapshot you took.

Like this from console, you can Restore your instance.

Let me know, if this doesn't work for you!



来源:https://stackoverflow.com/questions/42476941/how-to-restore-instance-using-snapshot-in-google-compute-engine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!