Monday, April 21, 2025

How to Connect (SSH) into EC2 Instance with Putty from a Windows11 Local Machine | Overview & Hands-On.

An Overview & Hands-On to  Connect (SSH) into a Linux Server (ubuntu flavor) with Putty from a windows11 Local Machine

Focus:

  • Tailored for SRE, DevOps, Cloud, and DevSecOps Engineers

Breakdown:

  • Intro,
  • Prerequisites (If twtech don't have PuTTY)
  • Connect using PuTTY,
  • Using SSH Keys for More Secure Access (Recommended),
  • Project-Hands-On.

Intro:

  • To connect to an Ubuntu server from Windows 11 using PuTTY, you need the server's IP address or hostname, and login credentials (username and password, or an SSH key).

Here are the steps:
Part 1: 
Prerequisites (If twtech don't have PuTTY)

  1. Download PuTTY: Open a web browser on twtech Windows 11 machine and download the PuTTY application from the official PuTTY website.
  2. Install: Run the installer file and follow the prompts to install the application.
Part 2: 
Connect using PuTTY
  1. Open PuTTY: Launch the PuTTY application from your Start Menu.
  2. Enter Connection Details: In the "Session" category on the left, you will see the configuration options:
    • Host Name (or Server IP address): Enter the Server IP address or the hostname of twtech Ubuntu server.
    • Port: Ensure this is set to the default SSH port, which is 22.
    • Connection type: Select SSH.
  3. Save the Session (Optional): In the "Saved Sessions" box, type a name for this connection (e.g., "twtechUbuntuServer") and click Save. This lets you double-click the name next time to load all settings automatically.
  4. Connect: Click the Open button at the bottom of the window.
  5. Security Alert (First Time Only):
    • If this is the first time connecting to this server, PuTTY will display a security alert asking twtech to confirm the server's host key.
    • Click Accept to trust the server and proceed.
  6. Log In:
    • A terminal window will open, prompting twtech for a username: login as:
    • Enter twtech Ubuntu username (e.g., ubuntu or twtech custom username) and press Enter.

  • It will then prompt for a password. 
  • Type twtech password and press Enter. 
NB:
  •  The cursor will not move or show characters as twtech types the password; this is a standard security feature. 
  • Once authenticated, twtech will be logged into the Linux server's command line interface. 
Part 3: 
Using SSH Keys for More Secure Access (Recommended) 
  • For better security, use SSH keys instead of passwords. This involves generating a pair of keys (a private key and a public key) and uploading the public key to your Ubuntu server. 

  1. Generate Keys: Use the puttygen.exe tool (installed alongside PuTTY) to create an SSH key pair. Save the private key (.ppk file) on twtech Windows machine.
  2. Upload Public Key: Copy the contents of the public key generated by PuTTYgen into twtech user's ~/.ssh/authorized_keys file on the Ubuntu server.
  3. Configure PuTTY:
    • In the PuTTY configuration window, go to Connection > SSH > Auth (or Credentials in newer versions).
    • Click Browse... and select the private key file (.ppk) twtech saved.
    • Go back to the Session screen, select twtech saved session name, and click Save to store this configuration.
  4. Connect with Key: When twtech connects, PuTTY will automatically use the private key for authentication, often skipping the password prompt entirely (unless twtech sets a passphrase on its private key).


Project: Hands-On

  • How twtech Connects (SSH) into EC2 Instance with Putty from a Windows11 Local Machine.

Step-1:

  • Provision a Server (EC2 Instance,

Step-2:

  • twtech downloads and install putty open-source tool to the windows machine (windows11).
  • Go to the link: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

  • Select the: 64bitx86 windows installer:


  • Putty package downloaded

Step-3:

  • Go to download folder in the windows11 local machine and run the setup.installer





  • Confirm and install Putty:



Step-4:

  • Accss the putty Program location, there will : puTTYy and puTTygen.

Step-5:

  • Right-click on puTTY and sent to the desktop for easier access.

  • Right-click on puTTYgen and sent to the desktop for easier access.

Step-6:

Go to desktop to verify if the shortcuts were sent successfully:

  • Click open puTTYgen:

  • Generate the .ppk key format from here

Step-7:

  • Upload the key.pem to convert to .pkk format
  • Select all file from dropdown menu of file categories to select the key.pem and open the file.


  • Save it as private key:  

  • Confirm to save private key.


Step-8:

  • To Use putty to ssh into the instance, 
  • Go to desktop and open putty app.

Step-9:
  • Copy the public IP address of Server(twtech-db-server)we want to ssh into (connect)



Step-10:
  • Configure the PublicIP and assign a saved sessions (twtech-EC2 Instance)

  • Click on saved sessions: twtech-EC2 Instance 

NB:

  • We still need to authenticate user login and  configure the path to ssh-key (twtec-puttykey.ppk)
  • (close (X) this windows)

Step-11:

  • Go back  to puTTy and click on saved session: twtech-EC2 Instance starts to Load
  • Add the hostname  (ubuntu, ec2-user) to the PubIPaddress to authenticate user login: and save configurations again.


Step-12:

  •  twtech adds the private key converted (twtech-puttykey.ppk) to putty.
    • Click on ssh
    • Then:   Auth,
    • then Browser Location where twtech-puttykey.ppk Credentials is created and stored.

  • Select the private key ( twtech-puttykey.ppk) and upload.

  • Go back to session: save configuration.

  • Open putty to access the instance ( twtech-db-server)

Step-13:
  • twtech should successfully connect (ssh) into a ec2 instance with putty tool 

  • twtech-users can at this point run commands, update and install packages to the EC2 instance from the terminal.



No comments:

Post a Comment

Amazon EventBridge | Overview.

Amazon EventBridge - Overview. Scope: Intro, Core Concepts, Key Benefits, Link to official documentation, Insights. Intro: Amazon EventBridg...