I have been using the following command to connect to my amazon ec2 instance from my OSX terminal:
ssh -i /path/my-key-pair.pem [email protected]
So I need to include the .pem file location on the command.
Is there any way, so that I do not need to specify the .pem file each time i connect?
Any help or suggestion will be appreciated. Thank you.
Ok, i have got the solution. Here I am sharing if someone need sometimes:
.pem
file to ~/.ssh
Create a config file at ~/.ssh
touch ~/.ssh/config
open the config file in nano or vim. nano ~/.ssh/config
Add the following line to config
file
Host host_name
HostName ec2.server.address.com
User ec2-user
IdentityFile "~/.ssh/ec2.pem"
Now connect from terminal: ssh host_name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With