简体   繁体   中英

connecting to multiple instances of EC2 with ssh

I just started out with Amazon web services and was able to launch an instance. A friend showed me a sample tutorial of how to connect to AWS with ssh. Pretty neat. I downloaded the key and edited /.ssh/config file. 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. 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). Thanks for the help.

You can ssh to any ec2 instance by running this on terminal:

ssh -i path_to_pem_file ubuntu@<HostIP_or_NAME>

eg.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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