Search code examples
amazon-web-servicesamazon-ec2

Connecting to AWS EC2 instance using Private Key and Host IP


I have a private key file named awskey.ppk and a host ip address (let's call this 123.45.678.910

I am trying to connect to the EC2 instance using the command line command -

ssh -i /Users/ashishagarwal/EC2/awskey.ppk [email protected]

This is giving me the error:

Permissions 0644 for '/Users/ashishagarwal/EC2/awskey.ppk' are too open. It is required that your private key files are NOT accessible by others. This private key will be ignored. bad permissions: ignore key: /Users/ashishagarwal/EC2/awskey.ppk Permission denied (publickey).

How do I fix this ?


Solution

  • Two things.

    1. chmod will fix your permissions. The file needs to be changed to 600 or 400.
    2. ppk format is used by putty, need to convert the key to pem encoded format. You can use the putty keygen tool for this.