如何在Google Compute Engine上创建的两个实例之间切换? [英] How to ssh between two instances created on Google Compute Engine?

查看:53
本文介绍了如何在Google Compute Engine上创建的两个实例之间切换?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Google Compute Engine上创建了两个实例:

I have created two instances on Google Compute Engine:

Instance A
hostname: robot-a
ip addr: 10.111.0.11

Instance B
hostname: robot-b
ip addr: 10.222.0.22

我可以从本地计算机登录两个实例.但是如何从其中一个登录到另一个实例?

I can log in to both instances from my local machine. But how can I log in to the other instance from one of them?

我尝试了以下操作,但失败了:

I tried the following, but failed:

robot-a$ ssh robot-b
The authenticity of host 'robot-b (10.111.0.11)' can't be established.
ECDSA key fingerprint is 3a:1a:f1:23:6a:83:ab:db:d8:a1:e8:7d:f5:65:c8:c5.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'robot-b' (ECDSA) to the list of known hosts.
Permission denied (publickey).

推荐答案

默认情况下,GCE实例设置了gcloud.那么,最简​​单的方法就是.

GCE instances have gcloud set up by default. then, the easiest way to go is.

gcloud compute ssh [INSTANCE_NAME] [--ZONE [INSTANCE_ZONE]]

可能需要区域标志,因为在该实例中之前没有运行过gcloud init.

the zone flag might be needed because gcloud init haven't been run before in that instance.

这篇关于如何在Google Compute Engine上创建的两个实例之间切换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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