Connecting to Your Linux Instance

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

To connect to your instance using PuTTY

  1. Start PuTTY (from the Start menu, choose All Programs, PuTTY, PuTTY).
  2. In the Category pane, choose Session and complete the following fields:
    1. In the Host Name box, enter user_name@public_dns_name (see Get Information About Your Instance for how to get the public DNS name of the instance). Be sure to specify the appropriate user name for your AMI. For example:
      • For Amazon Linux 2 or the Amazon Linux AMI, the user name is ec2-user.
      • For a CentOS AMI, the user name is centos.
      • For a Debian AMI, the user name is admin or root.
      • For a Fedora AMI, the user name is ec2-user or fedora.
      • For a RHEL AMI, the user name is ec2-user or root.
      • For a SUSE AMI, the user name is ec2-user or root.
      • For an Ubuntu AMI, the user name is ubuntu.
      • Otherwise, if ec2-user and root don’t work, check with the AMI provider.
    2. (IPv6 only) To connect using your instance’s IPv6 address, enter user_name@ipv6_address. Be sure to specify the appropriate user name for your AMI. For example:
      • For Amazon Linux 2 or the Amazon Linux AMI, the user name is ec2-user.
      • For a CentOS AMI, the user name is centos.
      • For a Debian AMI, the user name is admin or root.
      • For a Fedora AMI, the user name is ec2-user or fedora.
      • For a RHEL AMI, the user name is ec2-user or root.
      • For a SUSE AMI, the user name is ec2-user or root.
      • For an Ubuntu AMI, the user name is ubuntu.
      • Otherwise, if ec2-user and root don’t work, check with the AMI provider.
    3. Under Connection type, select SSH.
    4. Ensure that the Port value is 22.
  • (Optional) You can configure PuTTY to automatically send ‘keepalive’ data at regular intervals to keep the session active. This is useful to avoid disconnecting from your instance due to session inactivity. In the Category pane, choose Connection, and then enter the required interval in the Seconds between keepalives field. For example, if your session disconnects after 10 minutes of inactivity, enter 180 to configure PuTTY to send keepalive data every 3 minutes.
  • In the Category pane, expand Connection, expand SSH, and then choose Auth. Complete the following:
    1. Choose Browse.
    2. Select the .ppk file that you generated for your key pair and choose Open.
    3. (Optional) If you plan to start this session again later, you can save the session information for future use. Under Category, choose Session, enter a name for the session in Saved Sessions, and then choose Save.
    4. Choose Open.
  • 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 to which you are connecting.
  • (Optional) Verify that the fingerprint in the security alert dialog box matches the fingerprint that you previously obtained in (Optional) Get the Instance Fingerprint. If these fingerprints don’t match, someone might be attempting a “man-in-the-middle” attack. If they match, continue to the next step.
  • Choose Yes. A window opens and you are connected to your instance.NoteIf 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.

Leave a Reply

Your email address will not be published. Required fields are marked *