PuTTY does not natively support the private key format (.pem) generated by Amazon EC2. If you load the .pem formet private key directly to PuTTY you will get error message: Unable to use key file "***.pem" (OpenSSH SSH-2 private key).
PuTTY has a tool called PuTTYgen, which can convert keys to the required PuTTY format (.ppk). You must convert your private key into this format (.ppk) before connecting to your instance using PuTTY.
1. Install the latest version Putty for Windows.
2. Locate the private key.
.pem file for the key pair that you specified when you launched the instance.
3. Enable inbound SSH traffic from your IP address to your instance.
Your default security group does not allow incoming SSH traffic.
authorize Inbound Traffic for Your Amazon EC2 Linux Instances
4. Get the public DNS name of the instance or the Public IP address.
5. Converting Your Private Key Using PuTTYgen.
- Download the latest version PuTTYgen
- Start puttygen.exe
- Under Type of key to generate, select SSH-2 RSA
- Load your .pem file. Click Load. By default, PuTTYgen displays only files with the extension .ppk. To locate your .pem file, select the option to display files of all types.
- Click Save private key to save the key in the format that PuTTY can use. Note: You can use a passphrase to add an extra layer of protection to the private key.
6. Starting a PuTTY Session
- Fill in the public DNS name of the instance or the Public IP address.
- In the Category pane, expand Connection, expand SSH, and then select Auth.
- Browse and select the .ppk file that you generated for your key pair, and then click Open.
- login in as: ec2-user or ubuntu depends on the system that you selected for the instance. You can try to login as root first and find out what login name should you use.