In this post I’m going to show how to establish a SSH connection to an Amazon EC2 instance using Putty using a Windows box. First of all we need to download following tool. It can be find under the section called For Windows on Intel x86.
- Putty – http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
- Puttygen – http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Step 1: Generating the Private Key using Puttygen
In Amazon AWS environment each instance (EC2, RDS, ElasticCache, etc…) is attached to a permission/security group, access to each service is provided through Private Key/Public Key authentication. Each Amazon EC2 instance will holds the Public Key of the permission/security group it belongs. To connecting to a specific Amazon EC2 instance need to use the corresponding Private Key (xxx.pem). Puttygen can be used to generate the local Private key out from the Private Key obtained from Amazon AWS required for establishing the connecting to Amazon EC2 instance via Putty.
Open Puttygen as shown in Figure 1 and click Load to select the Private Key obtained form the Amazon AWS.
Figure 1: Selecting the Amazon AWS Private Key
Next click Save private key, next click OK on the appearing dialog box as shown in Figure 2 and 3
Figure 2: Saving the generated Private Key
Provide a suitable name (eg: aws_putty_private_key.ppk) for the newly created Private key, make sure to store all these keys in a well secure place.
Figure 3: Saving the generated Private Key
Step 2: Pointing the generated Private key to Putty
Now we have finish creating the private key required by Putty. Open Putty and navigates to Connection -> SSH -> Auth from the left pane of the Putty window as shown in Figure 4. Select the newly created private key (aws_putty_private_key.ppk) from the Options controlling SSH authentication pane as shown in Figure 5
Figure 4: Options controlling SSH authentication
Figure 5: Selecting the generated Private key
Step 3: Providing Amazon AWS EC2 instance information
Navigates to Session from the left pane of the Putty window as shown in Figure 6 and Provide the Host Name or the IP of the Amazon EC2 instance Connection Type as SSH.
Figure 6: Providing Amazon AWS EC2 instance information
Step 4: Connecting to Amazon AWS EC2 instance
Provides the User name of the EC2 instance.
Upon successful authentication connection is established. Happy hacking.