如何在Google Compute Engine中使用快照还原实例? [英] How to restore instance using snapshot in Google Compute Engine?
问题描述
我通过云控制台创建了VM实例的快照.我想知道如何使用快照还原实例.计算引擎的文档不是很有帮助.该实例在Ubuntu上运行.谢谢.
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.
推荐答案
要从快照中还原实例而不删除/重新创建实例,请执行以下操作:
To restore an instance from a snapshot without deleting/re-creating the instance:
-
关闭实例并分离启动磁盘:
gcloud beta compute instances detach-disk INSTANCE_NAME --disk BOOT_DISK_NAME
从快照创建新磁盘:gcloud compute disks create DISK_NAME --source-snapshot SNAPSHOT_NAME
将在步骤2中创建的磁盘作为启动磁盘:gcloud beta compute instances attach-disk INSTANCE_NAME --disk DISK_NAME --boot
Attach the disk created from step 2 as the boot disk: gcloud beta compute instances attach-disk INSTANCE_NAME --disk DISK_NAME --boot
还原实例而不删除/重新创建实例意味着还原后,实例将保留其IP地址和其他属性,例如标签,标签等.
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.
这篇关于如何在Google Compute Engine中使用快照还原实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!