I previously added into my local(Mac OS x 10.6) /etc/hosts file my server's public ip something like this:
to allow me to ssh to myServer without having to remember the ip address of the server and worked fine (using shh public key) , like this:
However on Amazon EC2 instance I tried to do the same using the long public dns address provided and in /etc/hosts I added this:
but when I try to ssh myServer2 says that the 'hostname cannot be resolved'
any ideas why this is not working? How can I make this work ?
The complete command I want to use is:
ssh -i key.pem firstname.lastname@example.org
and I am trying to create a shortcut which might be something like this:
ssh -l username myServer2 or ssh -i key.pem -l username myServer2
UPDATE: I used alias instead which is easier:
Added this inside .bash_profile (MAC OS x)
alias myServer='ssh -i /path/to/key.pem email@example.com'
(need to close and open terminal again or use source ~/.bash_profile ) Then ssh with just using myServer on command line $ myServer