Wednesday, October 22, 2025

AWS - SSH protocol

What is SSH?

SSH = Secure Shell
It is a network protocol that allows you to securely connect to and manage remote servers over an encrypted channel.

  • Works on port 22 (by default).

  • Provides authentication (usually via username + password or SSH keys).

  • Encrypts all traffic (unlike old protocols like Telnet or FTP which send data in plain text).


What You Can Do With SSH

  1. Remote login → Securely access and control Linux/Unix servers.

  2. File transfers → Using scp or sftp (built on SSH).

  3. Tunneling/Port forwarding → Securely forward traffic (e.g., database connections).

  4. Automation → Used in scripts, CI/CD pipelines for remote execution.


How SSH Works

  1. Client → Server: You run ssh user@server-ip.

  2. Handshake: The server and client exchange keys to set up encryption.

  3. Authentication:

    • Password-based OR

    • Key-based (preferred) → You use an SSH key pair:

      • Private key (kept safe on your local machine).

      • Public key (stored on the server in ~/.ssh/authorized_keys).

  4. Secure Session: You now have a secure shell to run commands remotely.


SSH in AWS

  • When you launch an EC2 instance, you usually connect via SSH.

  • AWS gives you a key pair (.pem file) when creating the instance.

  • Example command:

    ssh -i my-key.pem ec2-user@ec2-54-123-45-67.compute-1.amazonaws.com
  • Without SSH, you wouldn’t be able to log in securely to manage EC2 Linux instances.

No comments:

Post a Comment

CI/CD - Safe DB Changes/Migrations

Safe DB Migrations means updating your database schema without breaking the running application and without downtime . In real systems (A...