Add an EC2 PEM Key to SSH on Linux and Mac OS X

Download your PEM file from Amazon EC2. Then, import it into your SSH store with this command:

Then you can simply connect to your EC2 instance via SSH like so:

You must do this every time you restart your computer. To make this permanent, add the command to your .bashrc file (Linux) or .bash_profile files (Mac).

1 Comment

  1. Thanks, I have question which ec2 server name will be given here, Private DNS, Private IP or public?
    If we use public ip or dns then it will be changed after instance restart. Please clarify my this confusion

Leave a Reply

Your email address will not be published.


*