Tag: ssh key

Retrieving the AWS Public Key for Your Key Pair on Linux

On a Linux instance, the public key content is placed in an entry within ~/.ssh/authorized_keys. This is done at boot time and enables you to securely access your instance without passwords. You can open this file in an editor to view the public key for your key pair. The following is an example entry for the key pair named my-key-pair. It consists of the public key followed by the name of the key pair.

You can use ssh-keygen to get the public key for your key pair. Run the following command on a computer to which you’ve downloaded your private key:

When prompted to enter the file in which the key is, specify the path to your .pem file; for example:

/path_to_key_pair/my-key-pair.pem

The command returns the public key.

If this command fails, ensure that you’ve changed the permissions on your key pair file so that only you can view it by running the following command:

source: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html#retrieving-the-public-key