Table of Contents

SSH Connection Tutorial

Connecting to Your Linux Instance from a Linux Workstation using SSH client

If you are a linux user, simply connect using the typical method, using your .pem keyfile and this command, substituting your own DNS name or Elastic IP after the @ symbol:

ssh -i my-key-pair.pem ec2-user@<ec2-123-45-67-89.compute-1.amazonaws.com>

Connecting to Your Linux Instance from Windows Using PuTTY

After you launch your instance, you can connect to it and use it the way that you'd use a computer sitting in front of you.

NOTE: After you launch an instance, it can take a few minutes for the instance to be ready so that you can connect to it. Check that your instance has passed its status checks - you can view this information in the Status Checks column on the Instances page.

The following instructions explain how to connect to your instance using PuTTY, a free SSH client for Windows. If you receive an error while attempting to connect to your instance, see Troubleshooting Connecting to Your Instance.

Prerequisites

Before you connect to your Linux instance using PuTTY, complete the following prerequisites:

Converting Your Private Key Using PuTTYgen

PuTTY does not natively support the private key format (.pem) generated by Amazon EC2. PuTTY has a tool named PuTTYgen, which can convert keys to the required PuTTY format (.ppk). You must convert your private key into this format (.ppk) before attempting to connect to your instance using PuTTY.

To convert your private key

Start PuTTYgen (for example, from the Start menu, click All Programs > PuTTY > PuTTYgen).

NOTE: A passphrase on a private key is an extra layer of protection, so even if your private key is discovered, it can't be used without the passphrase. The downside to using a passphrase is that it makes automation harder because human intervention is needed to log on to an instance, or copy files to an instance.

Your private key is now in the correct format for use with PuTTY. You can now connect to your instance using PuTTY's SSH client.

Starting a PuTTY Session

Use the following procedure to connect to your Linux instance using PuTTY. You'll need the.ppkfile that you created for your private key. If you receive an error while attempting to connect to your instance, see Troubleshooting Connecting to Your Instance.

To start a PuTTY session

aws ec2 get-console-output --instance-id instance_id

ec2-get-console-output instance_id

NOTE: The SSH HOST KEY FINGERPRINTS section is only available after the first boot of the instance.

WARNING: By setting this option, you will be automatically logged in with root privileges and anything you do once logged in will be performed as root. You can damage your instance if you execute the wrong commands.

NOTE: If you specified a passphrase when you converted your private key to PuTTY's format, you must provide that passphrase when you log in to the instance.

If you receive an error while attempting to connect to your instance, see Troubleshooting Connecting to Your Instance.