Thursday, May 15, 2014

Connect to Your Amazon EC2 Instance from Windows Using PuTTY

If you are running Windows from your local machine, you will need to install PuTTy and PuTTyGen since SSH is not built in. To connect to a Linux instance, you must retrieve the initial administrator password first, and then use it with Microsoft Remote Desktop. You'll need the contents of the private key file that you created (e.g., mykeypair.pem) in Step 5: Create a Key Pair.
To connect to your Amazon EC2 instance from a Windows machine
  1. Install PuTTy and PuTTyGen.
    1. Download and install PuTTy. A search on "download Putty" on Google returns a list of download sites. Be certain that you install both PuTTy and PuTTyGen, because you will need both of them.
  2. Convert the key pair using PuTTyGen. (For information on key pairs see Step 5: Create a Key Pair).
    1. Launch PuTTyGen and select Import Key from the Conversions menu.
    2. Browse for mykeypair.pem, and import the key.
    3. Click Save private key. Ignore the dialog box that asks if you want to do this without a passphrase. Save the key as mykeypair.ppk.
    4. Close PuTTyGen.
  3. Configure the SSH settings.
    1. Launch PuTTy, expand the SSH node, and click Auth.
    2. Enter the location for mykeypair.ppk.
  4. Modify the keepalive.
    1. In the PuTTy Configuration window, in the Category pane, click Connection.
    2. Type 60 in the Seconds between keepalives (0 to turn off) box. If you don't change this value, your session will time out.
  5. Save the session settings.
    1. In the PuTTy Configuration window, in the Category pane, click Session.
    2. Inside the Load, save, or delete a stored session box, click Default Settings, and click Save.
  6. Type the DNS address of your Amazon EC2 instance.
    1. Sign in to the AWS Management Console and open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
    2. Make sure US East (N. Virginia) is selected in the region selector of the navigation bar.
    3. In the navigation pane, click Instances.
    4. Select your running instance and note the public DNS address in the bottom pane.
    5. In the PuTTy Configuration window, click Sessions in the Category pane, and in the Host Name (or IP address) box, type <ec2-user@DNS address of your Amazon EC2 instance>.
      Note
      We put ec2-user in front of the DNS name because the username for the AMI is ec2-user.
    6. Click Open. When the PuTTY Security Alert dialog box appears, click Yes to confirm that the fingerprint is OK. The SSH PuTTY window will launch.
      Note
      The SSH fingerprint will eventually show up in the system log. You can use the SSH fingerprint as a comparison to protect against a man in the middle attack.
      Your screen should look similar to the following screen.
    7. Use the sudo service httpd start command to start the web server.
      sudo service httpd start
      Your screen should look similar to the following screen.

0 comments: