![我可以将我的 Google Compute Engine VM 连接到 Cloud Shell 吗?](https://linux22.com/image/741894/%E6%88%91%E5%8F%AF%E4%BB%A5%E5%B0%86%E6%88%91%E7%9A%84%20Google%20Compute%20Engine%20VM%20%E8%BF%9E%E6%8E%A5%E5%88%B0%20Cloud%20Shell%20%E5%90%97%EF%BC%9F.png)
我想知道是否有办法将我的 Google Compute Engine VM 连接到 Cloud Shell。目的是让我可以使用 Cloud Shell 编辑器编辑 VM 中的文件。谢谢。
答案1
Cloud Shell 环境是一个使用 g1-small 机器类型的 Docker 容器。
您可以使用gcloud 命令从 Cloud Shell 到 SSH 到您的虚拟机。从那里,您可以使用经典的 Linux 终端命令添加和编辑文件。
gcloud compute ssh --project [PROJECT_ID] --zone [ZONE] [INSTANCE_NAME]
使用 Cloud Shell 编辑器您只能移动 Cloud Shell VM 的文件,但不能将此编辑器用于在 Google Cloud Platform 中创建的 VM。
您还可以更改 Cloud Shell 环境映像,但不能是任何 GCP VM。以下是直接链接。