Amazon Elastic Compute Cloud
User Guide (API Version 2014-06-15)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

Connect to Your Instance

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

It may take a couple of minutes after launch for your running instance to finish provisioning 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. If you receive an error while attempting to connect to your instance, see Troubleshooting Connecting to Your Instance.

Before you try to connect to your instance, be sure that you've completed the following tasks:

  • Get the public DNS name of the instance

    You can get the public DNS for your instance using the Amazon EC2 console (check the Public DNS column; if this column is hidden, click the Show/Hide icon and select Public DNS). If you prefer, you can use the describe-instances (AWS CLI) or ec2-describe-instances (Amazon EC2 CLI) command.

  • Locate the private key

    You'll need the fully-qualified path of the .pem file for the key pair that you specified when you launched the instance.

  • Enable inbound SSH traffic from your IP address to your instance

    Ensure that the security group associated with your instance allows incoming SSH traffic from your IP address. For more information, see Authorizing Network Access to Your Instances.

    Important

    Your default security group does not allow incoming SSH traffic by default.

There are several ways to connect to a Linux instance. Choose the method that meets your needs:

Next Step

After you've successfully launched and connected to your instance, you can do any of the following:

Option 1: Connect Using Your Browser

You must have Java installed and enabled in the browser. If you don't have Java already, you can contact your system administrator to get it installed, or follow the steps outlined in the following pages: Install Java and Enable Java in your web browser.

To connect to your Linux instance using a web browser

  1. From the Amazon EC2 console, click Instances in the navigation pane.

  2. Select the instance, and then click Connect.

  3. Click A Java SSH client directly from my browser (Java required).

  4. Amazon EC2 automatically detects the public DNS name of your instance and populates Public DNS for you. It also detects the key pair that you specified when you launched the instance. Complete the following, and then click Launch SSH Client.

    1. In User name, enter ec2-user.

      Tip

      For Amazon Linux, the user name is ec2-user. For RHEL5, the user name is either root or ec2-user. For Ubuntu, the user name is ubuntu. For Fedora, the user name is either fedora or ec2-user. For SUSE Linux, the user name is root. Otherwise, if ec2-user and root don't work, check with your AMI provider.

    2. In Private key path, enter the fully qualified path to your private key (.pem) file, including the key pair name; for example:

      C:\KeyPairs\my-key-pair.pem

    3. (Optional) Click Store in browser cache to store the location of the private key in your browser cache. This enables Amazon EC2 to detect the location of the private key in subsequent browser sessions, until you clear your browser's cache.

  5. If necessary, click Yes to trust the certificate, and click Run to run the MindTerm client.

  6. If this is your first time running MindTerm, a series of dialog boxes asks you to accept the license agreement, to confirm setup for your home directory, and to confirm setup of the known hosts directory. Confirm these settings.

  7. A dialog prompts you to add the host to your set of known hosts. If you do not want to store the host key information on your local computer, click No.

  8. A window opens and you are connected to your instance.

    Note

    If you clicked No in the previous step, you'll see the following message, which is expected:

    Verification of server key disabled in this session.

Option 2: Connect from Windows Using PuTTY

PuTTY doesn't use .pem files, it uses .ppk files. If you haven't already generated a .ppk file, do so now. For more information, see To prepare to connect to a Linux instance from Windows using PuTTY.

To connect to your Linux instance using PuTTY

  1. Start PuTTY (from the Start menu, click All Programs > PuTTY > PuTTY).

  2. In the Category pane, select Session and complete the following fields:

    1. In the Host Name box, enter ec2-user@public_dns_name.

    2. Under Connection type, select SSH.

    3. Ensure that Port is 22.

  3. In the Category pane, expand Connection, expand SSH, and then select Auth. Complete the following:

    1. Click Browse.

    2. Select the .ppk file that you generated for your key pair, and then click Open.

    3. Click Open to start the PuTTY session.

  4. If this is the first time you have connected to this instance, PuTTY displays a security alert dialog box that asks whether you trust the host you are connecting to. Click Yes. A window opens and you are connected to your instance.

Option 3: Connect from Mac or Linux Using an SSH Client

Your Mac or Linux computer most likely includes an SSH client by default. You can check for an SSH client by typing ssh at the command line. If your computer doesn't recognize the command, the OpenSSH project provides a free implementation of the full suite of SSH tools. For more information, see http://www.openssh.org.

Open your command shell and run the following command:

$ ssh -i /path/key_pair.pem ec2-user@public_dns_name

Tip

For Amazon Linux, the user name is ec2-user. For RHEL5, the user name is either root or ec2-user. For Ubuntu, the user name is ubuntu. For Fedora, the user name is either fedora or ec2-user. For SUSE Linux, the user name is root. Otherwise, if ec2-user and root don't work, check with your AMI provider.