We can use pem file to login into remote server from our local machines. Infact if you use AWS, the only way to SSH into the server is using pem file.
cd ~
ssh-keygen -t rsa -b 2048
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa):