Connecting to AWS EC2 instance using PuTTY as SSH client - How?

 Took me a while to write this down. Not because it's complicated, but me! As Taylor Swift benevolently sings, "It's me! I - I'm the problem! It's me!" It resonated with my entire laziness. At this point it's just my personality. This is one of my favorite quotes - "Out of many things we are normalizing, we should be normalizing being lazy". If you are wondering who said that, it's definitely some lazy person and that lazy person is me (lazily scoffs in a corner). 

Before the article becomes "Me and Laziness ", I should start with the our article.


Story of my life

In the previous article, we clarified why SSH clients, specifically why puTTY is used. Basically, remote desktop is connecting to a PC/server elsewhere and using/manipulating it as if one is sitting in front of it. Even though it made communications and functionalities easy, it also came with drawbacks, by not being secure enough. 

Thus, the SSH ( Secure Shell protocol) was implemented wherein public and private keys which worked as lock and key respectively was introduced. puTTY is one such SSH client or a program which enables securely establishing and authenticating SSH connections. We use puTTY mainly in Windows because of its easy GUI and numerous features making it an easy tool.

Now to the "How" of connecting to the instance. 

  • Create an EC2 instance from the AWS console as given in the article till the dialog box "Connect to instance". In the above mentioned article, we used EC2 instance connect. As we are using puTTY, slide to "SSH client" slider. Copy the Public DNS in "4. Connect to instance using its Public DNS" and save it in a notepad. We'll be needing this in the future. Another crucial step is to keep the Keypair created (in the linked article) as well. Keep the location handy, as it's required for the future.

Select SSH client. Copy the Public DNS.


Copy the Public DNS and paste in a notepad.

Keep the Keypair location handy.
  • We have to install puTTY at this stage. Go to your search engine and type "putty download". Click the topmost link (most likely the official putty website). Click on "Download puTTY". Select "MSI('Windows Installer')". Select the link across "64-bit- x86". Putty setup wizard dialog box appears. Click "Next" and enter your desired location to access it and click "Finish". You have successfully installed puTTY.


Click on the website.


Click on "Downlaod PuTTY".


The above page opens.


Click on the link across 64-bit x86.



Setup wizard pops up.



Click "Next" until the below.



Click on "Finish".

  • Open puTTY. In the dialog box,  in "Host name (or IP address)" column paste the Public DNS copied in step 1. Create a name for the session in "Saved session" and save it to enable loading it in the future by just clicking on the saved names (here, AWS EC2). This whole area comes under the "Session" "Category" .

puTTY dialog box.



Paste the Public DNS copied as above.


Save the session. Here, AWS EC2.


  • Select "Auth" from "Category" in the left hand side of the dialog box. Click on "Credentials". This is the pivotal step where we are authenticating the Public key (Public DNS) with the private key (which is in our system, key_1.ppk. Refer step 1).  In the "Private key file for authentication:" column, click on the "Browse" button and find the location of the private key file in step 1. 

Click "Credentials" in "Auth".

"Browse" the Keypair as shown in step 1.


  • Make sure the previous steps are completed and click "Open". A terminal/CLI opens with a dialog box. Click "Accept the conditions" and now type the username (if asked), which is usually the AMI name, here Ubuntu. Press enter.

Terminal/CLI opens.


And voila! You have successfully connected to your EC2 instance using puTTY. One major thing to remember is to hide your addresses and information which can be used for malicious purposes (Ex. IP address). 

 The next article is about how we use the instances to our use. We'll be using the instances we have created for various purposes and learn more as to why and how we'll be doing so. Until then, Tata!  

I had to put this here.




Comments

Popular posts from this blog

Version Control Systems (VCS)

Creating AWS EC2 instance

Linux commands - Part II - How?