Google Compute Engine:使用另一个项目的快照? [英] Google Compute Engine : Use snapshot from another project?

查看:16
本文介绍了Google Compute Engine:使用另一个项目的快照?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的开发者控制台中有两个项目.我已经拍摄了 project-1 中其中一个 VM 的快照".我想使用在 project-1 中创建的快照在 project-2 中创建一个新的 VM.现在快照没有显示在选项中.如何将快照从一个项目导入到另一个项目?

I have two projects in my developer console. I have taken a "Snapshot" of one of the VMs in project-1. I want to create a new VM in project-2 using the snapshot created in project-1. Right now snapshot is not showing in the option. How can I import snapshot from one project to another?

推荐答案

您可以从 Project 1 中的 snap 创建一个图像,然后使用 Project 2 从该图像创建一个实例.

You can create an image from the snap in Project 1, then create an instance from that image using Project 2.

我假设您在两个项目中都拥有编辑权限.

I'm assuming you have edit rights in both projects.

您的问题是说您有一个快照,并希望从项目 1 中的快照中创建项目 2 中的一个实例.

Your question says you have a snapshot and want to make an instance in project 2 from the snap in project 1.

如果您仍然拥有已创建快照的可用磁盘,请确保它不再附加到实例.如果它仍然附加到实例,请取消选中删除实例时删除启动磁盘"并删除实例.转到图像并单击从磁盘创建图像,然后从此磁盘创建图像.

If you still have the disk available that you had snapshotted, make sure it's no longer attached to an instance. If it's still attached to the instance, uncheck "delete boot disk when deleting instance" and delete the instance. Go to Images and click create image from disk, and create an image from this disk.

如果您没有可用磁盘,只有快照,请创建一个实例并将启动磁盘设置为快照并选择您的快照.然后按照上面的说明通过先删除实例来创建一个图像.

If you do not have the disk available, but just the snapshot, create an instance and set the boot disk as a snapshot and select your snapshot. Then follow the directions above to create an image by deleting the instance first.

现在您在项目 1 中有一张图片.您应该会看到它列在图片下方.

Now you have an image in project 1. You should see it listed under images.

我不知道为什么,但是您不会在项目 2 的控制台中看到列出的图像,但是您可以使用 gcloud 使用项目 1 中的图像在项目 2 中创建一个实例.在项目 1 中,单击在图像上并单击查看 REST",将出现该图像的完整 URL,类似于:

I'm not sure why, but you won't see the image listed in the console in project 2, however you can use gcloud to create an instance in project 2 using the image from project 1. In project 1, click on the image and click "view REST" there will be a full URL to the image, similar to this:

https://www.googleapis.com/compute/v1/projects/cpomeroy-whitelist/global/images/ruby-image

使用 gcloud 使用项目 1 中的图像在项目 2 中创建实例:

Use gcloud to create an instance in project 2 using the image in project 1:

gcloud config set project <project-id-of-project-2>
gcloud config list

(您应该验证您在项目 2 中)

(You should verify you are in project 2)

gcloud compute instances create <name of instance> --image https://www.googleapis.com/compute/v1/projects/cpomeroy-whitelist/global/images/ruby-image

显然您的网址会有所不同.

Obviously your URL will be different.

我刚刚测试了这个并且它有效.如果您需要更多帮助,请告诉我.

I just tested this and it works. Let me know if you need more help.

这篇关于Google Compute Engine:使用另一个项目的快照?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆