Search blog

Sunday, April 23, 2017

[SOLVED] - Connecting to Amazon EC2 Instance from Terminal in Ubuntu using SSH

This tutorial shows you how to connect to your Amazon EC2 Instance from your Ubunut's terminal/CLI by making use of SSH.

NOTE: if you have not installed a tool like OpenSSH in your Ubuntu system you may do so by checking out the following tutorial: http://linux-sys-adm.com/how-to-install-and-configure-ssh-on-ubuntu-server-14.04-lts-step-by-step/ or use a tool like PuTTY.

1. First down the EC2 Key Pair Private Key for your EC2 instance. To generate Key Pair, you may check the following tutorial: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html

2. Copy the Key pair (.pem) key to the location of your choice and make note of the location path. In my case, I created a folder called 'aws-keys' under my 'home' directory and placed the '.pem' file there.

3. Open your terminal & change the file/folder permission to 600 where you have stored your '.pem' key, else you will get an error as shown in the image below:

Click image to enlarge

NOTE: since you have changed 'file permission' to 600, you will have to use sudo.

$ sudo chmod -R 600 aws-keys

4. Now enter the following commands to connect to your AWS EC2 Instance:

Email Subscription:

Support/Donate:

Drupal Association Member

eV@gabond - The Meaning

" I want to be an educated vagabond, not a vagabond out of weakness. I don't want to do anything in my life out of weakness - because I could not be anything else, that's why I am a Vagabond - that is not my way. First I want to prove to the world that I can be anything that I want to be, but still I choose to be a vagabond - out of strength. Then there is respectability even if you are a Vagabond, because respectability has nothing to do with your vocation, your profession; respectability has something to do with acting our of strength, clarity, intelligence. "