How to connect Mac terminal with EC2 instance

11,207

Solution 1

You need to know the .pem file folder you download, and then follow steps below:

  1. download the keypair(.pem file)
  2. cd to keypair(.pem file) location (Note that you can use absolute path name for key pair instead)
  3. chmod 400 [your_key_name].pem (Note that to make SSH work, your key must not be publicly viewable. Use this command if needed.)
  4. ssh -i "[your_key_name].pem" ec2-user@[your ec2 dns name]

Solution 2

You will have to convert your "ppk" file to "pem" file follow this steps.

http://www.ramsmusings.com/2014/02/20/converting-a-putty-ppk-file-to-a-pem-file-for-accessing-aws-ec2-instances/

After you convert connect to the instance using the SSH command and converted "pem" file.

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html

Share:
11,207

Related videos on Youtube

ENIO MARKU
Author by

ENIO MARKU

Updated on September 14, 2022

Comments

  • ENIO MARKU
    ENIO MARKU over 1 year

    I am using mac terminal and I want to connect my machine with server instance EC2 in aws with SSH. Since I am using Mac OS X is not necessary to use PUTTY. The problem is that when I download the key it is with extension .ppk but when i need to run it on terminal i need to use a command in which i have to use .pem extension . I tried to run it in that way and it said to me permission denied. Can someone help me what to do in this case? Do i have to change the permission or to convert my key from .ppk to .ppm?

  • error2007s
    error2007s over 7 years
    This is not the correct answer the use has a PPK file it needs to be converted to PEM first then the above steps will work.
  • Hashim Akhtar
    Hashim Akhtar about 2 years
    On a mac you can also right click the file, go to "Get Info" remove permissions for "Staff", set "Everyone" to "No Access" and make sure no one other than you is there.