The current project which I'm working on is hosted on Amazon's EC2 server. And we get .pem file to log in to Amazon EC2 server. To Log in to the server we'll need following things:
  • Server username (default is ubuntu)
  • Valid .pem file. I've renamed the .pem file to drupaltest.pem, which I'll be using further.
Here's how to SSH to Amazon EC2 server using .pem file:
  • First, place a ".pem" file in a location, where you can easily find it. I've placed it in ~/Documents directory.
  • Change permission of .pem file to either 700, 600, 500. If you set permission to 770 or 777 it wont allow you to log into the server, with error as below:
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    @  WARNING: UNPROTECTED PRIVATE KEY FILE! @
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    Permissions 0770 for 'drupaltest.pem' 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: drupaltest.pem
    Permission denied (publickey).
  • Once we've proper permissions to .pem file, we'll now log into our Amazon Server by entering following command in Terminal.
    $ ssh -i drupaltest.pem ubuntu@public-ec2-host
  • And you're done.. woo hoo..

Reference:

Submitted by ychaugule on