AWS Certified Cloud Practitioner / EC2 - Elastic Compute Cloud

How to SSH using Windows

πŸ–ΌοΈ How It Works (Conceptual Diagram)

  • Your Windows machine β†’ connects via internet

  • Through port 22 (SSH)

  • Into your EC2 instance (Amazon Linux 2)


βš™οΈ Step 1: Install PuTTY

πŸ‘‰ PuTTY is a free SSH client for Windows

  1. Download PuTTY (64-bit installer recommended)
    https://the.earth.li/~sgtatham/putty/latest/w64/putty-64bit-0.83-installer.msi

  2. Run installer β†’ Click:
    Next β†’ Next β†’ Install β†’ Finish

βœ… After installation, you’ll have:

  • PuTTY (main app)

  • PuTTYgen (key converter)


πŸ”‘ Step 2: Convert .pem β†’ .ppk

AWS gives you a .pem file (During ec2 cration), but PuTTY needs .ppk

  • Open PuTTYgen

  • Click Load

  • Change file filter β†’ All Files

  • Select your .pem file (e.g., EC2Tutorial.pem) You should see or Rename it to this:

  • Click Open

πŸ‘‰ You’ll see: β€œSuccessfully imported key”

  • Click Save private key

  • Save as:

EC2Tutorial.ppk

⚠️ If prompted about passphrase: Click Yes (skip for now)


🌐 Step 3: Configure PuTTY Connection

Open PuTTY and do the following:

Enter Host Name

ec2-user@<your-public-ip>

Example:

ec2-user@3.250.xxx.xxx

πŸ‘‰ Why ec2-user : Default username for Amazon Linux 2

Save Session

  • Name it: EC2 Instance

  • Click Save


πŸ” Step 4: Attach Your Private Key

Navigate:

  • Go to:

    SSH β†’ Auth
  • Click Credentials

  • Select your .ppk file

⚠️ IMPORTANT

πŸ‘‰ Go back to:

Session β†’ Save again

βœ”οΈ This prevents redoing everything later


πŸš€ Step 5: Connect to Your EC2 Instance

  1. Click Open

  2. First time β†’ Click Yes (trust host)

πŸ’» You’re In! πŸŽ‰

You should now see something like:

ec2-user@ip-172-31-xx-xx:~$

πŸ§ͺ Try These Commands

whoami

πŸ‘‰ Output:

ec2-user
ping google.com

πŸ‘‰ Stop with:

Ctrl + C

❌ Common Error

If you see:

Access denied / Authentication failed
  • Make sure you:

    • Added .ppk file βœ…

    • Used ec2-user@IP βœ…

    • Saved session properly βœ…


πŸ” Reconnecting

Next time:

  1. Open PuTTY

  2. Select EC2 Instance

  3. Click Load

  4. Click Open

βœ… Done β€” no reconfiguration needed