简体   繁体   English

使用ssh连接到多个EC2实例

[英]connecting to multiple instances of EC2 with ssh

I just started out with Amazon web services and was able to launch an instance. 我刚开始使用Amazon Web服务,并且能够启动一个实例。 A friend showed me a sample tutorial of how to connect to AWS with ssh. 一位朋友向我展示了一个如何通过ssh连接到AWS的示例教程。 Pretty neat. 漂亮整齐。 I downloaded the key and edited /.ssh/config file. 我下载了密钥并编辑了/.ssh/config文件。 Sample of the config file 配置文件样本

Host *
ServerAliveInterval 300

Host <name desired to connect>
 HostName <domain name>
 port 22
 User ubuntu
 IdentityFile /pathname/keyfile

My question is what if i have 2 instances and now i want to ssh to the new instance launched. 我的问题是,如果我有2个实例,现在我想使用ssh启动新实例。 How will i edit the config file. 我将如何编辑配置文件。 I'm stuck and also new to Linux(been learning Linux yesterday and it's pretty cool and powerful). 我很迷茫,对Linux也很陌生(昨天开始学习Linux,它非常酷,功能强大)。 Thanks for the help. 谢谢您的帮助。

You can ssh to any ec2 instance by running this on terminal: 您可以通过在终端上运行以下命令来切换到任何ec2实例:

ssh -i path_to_pem_file ubuntu@<HostIP_or_NAME>

eg. 例如。

ssh -i /temp/root1.pem ubuntu@54.23.122.34

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM