Fab*_*obs 7 networking virtual-machine google-compute-engine
我有几个 Google Compute Engine (GCE) 虚拟机分布在两个 GCE 网络中。现在我想将它们全部移动到一个共享网络,但我找不到一种方法来更改现有 VM 的网络。有没有办法做到这一点,或者我是否必须在新网络中重新创建 VM?
虽然您不能直接移动实例,但 Google Developers Console 现在具有克隆此实例的功能。转到Google Developers Console,导航到Project ID -> Compute Engine -> VM Instances ->。向下滚动到最后,您应该会看到该选项
单击Clone this instance 后,您将进入新的实例创建页面,其中有一个选项可以选择您希望克隆目标实例的区域。
您可以使用该gcutil moveinstances
命令将实例从一个可用区移动到另一个可用区。您甚至可以使用正则表达式移动实例列表,例如:
gcutil moveinstances --source_zone=zone-a
--destination_zone=zone-b "i-[0-9]" "b-.*"
Run Code Online (Sandbox Code Playgroud)
有关更多信息,请键入 gcutil help moveinstances
小智 -1
是的,您可以做到这一点,而且非常简单。
使用 Instance-DeleteAccessConfig 和 Instace-AddAccessConfig 方法在运行的实例上热删除和热添加网络配置。
在这种情况下,您将首先在实例上调用 deleteAccessConfig 将其从第一个网络中删除,然后调用 addAccessConfig 将其添加到第二个网络中。
此处的文档: https: //developers.google.com/compute/docs/reference/latest/instances/deleteAccessConfig https://developers.google.com/compute/docs/reference/latest/instances/addAccessConfig