Last Updated: February 25, 2016
·
503
· shaikhul

Taking advantage of SSH Config

I've to ssh into EC2 instances frequently, initially i was doing with following command

me@group ~ $ ssh me@amazon-ec2-instance-public-ip -i ~/.ssh/my-public-key 

and typing this all the time doesn't make any sense, so i look forward to automate this and found ssh config options. That said I have to update ~/.ssh/config with following

Host dev
    HostName public-ip-goes-here
    User me
    IdentityFile ~/.ssh/my-public-key

thats it, every time i need to ssh to that machine, i just type following in the command prompt

me@group ~ $ ssh dev

More options can be found at http://linux.die.net/man/5/ssh_config