The default method to access Linux EC2 instances on AWS is via SSH. Password authentication is by default disabled, and it forces you to use a public-key authentication method. The public SSH key is added automatically to the default user's authorised_key file, and the private key is chosen and/or created when creating the EC2 instance. The same is true for either Red Hat or Ubuntu-based EC2 instances.

SSH client is typically included in the default installation of Linux or other Unix-based operating systems, but not so in Windows. You need to install OpenSSH client for Windows or use third-party SSH clients such as PuTTY to login to your Linux EC2 instance.

Steps to SSH to Linux AWS EC2 instance from Windows using PuTTY:

  1. Make sure the security group of your EC2 instance is configured to allow SSH connection from your current host or use a VPN or proxy server if necessary.

  2. Convert the provided pem private key file to ppk (PuTTY Private Key) format.

  3. Download PuTTY from the official website.

    https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

  4. Launch PuTTY.

  5. Enter the Host Name or IP Address of your ec2 instance.
  6. Go to ConnectionSSHAuth from the sidebar menu.
  7. Click on the Browse button to look for your PuTTY Private Key.
  8. Select your PuTTY Private Key from the stored location and click on the Open button.
  9. Click on the Open button to start the connection.

  10. Click Yes if a security alert pops up as this is your first connection to the server and the server's key fingerprint is not in your PuTTY's cache.

  11. Enter the username that you want to connect as and press enter.
  12. Enter the passphrase for the key if a passphrase protects your key..
  13. You should now are logged in using the public key authentication to the system.