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:

 sudo ssh -i file_name.pem ec2-user@<publicDNS>  

You can find your publicDNS in your EC2 Dashboard. Please refer image below:

Click image to enlarge
If login is successful you will see a message similar to the one show in the image below, depending upon your Amazon Machine Image (AMI).

Click image to enlarge

No comments:

Post a Comment

Thank you for your Feedback!
www.evagabond.me

Top Magento Hosting:

Top 5 Posts (Weekly)

Lets Connect: