Skip to content

Connect to a Linux EC2 instance in SSH mode with PuTTY

Marc Grossouvre edited this page Oct 11, 2019 · 3 revisions

Pre-requisites

  • Download and install PuTTY from here.
  • Your EC2 instance muste have a public IP address (see Reserve and assign a static IP for an existing EC2 instance)
  • Get your EC2 public IP address : -> EC2 Dashboard -> Instances -> read the public IP on your instance line.
  • Port 22 must be open on your instance for ssh connection (see Open port 22 for ssh connection on an EC2 instance)
  • You must have a key pair attached to your instance (this is done at creation time see Create an EC2 instance in a public or private subnet)
  • Check your key pair name : EC2 Dashboard->Instances-> Read "Key Pair" line in "Description" pane
  • Make sure that you have the corresponing private key under format myKeyName.ppk. If you have the original .pem file, convert it (see Convert a .pem private key file to a .ppk one with PuTTYgen)
  • You must know the username with which you'll connect. It sounds obvious but unfortunately it depends on the AMI you have chosen at EC2 creation time. For "Amazon Linux 2 AMI (HVM), SSD Volume Type", it is ec2-user . For Ubunto distribution, it is ubuntu.
    • In case you don't know the default user, check your AMI ID (EC2 Dashboard -> Instances -> Description tab) and search ! But usually it is ec2-user or root

Step by step

  • Launch PuTTY
  • Enter your EC2 instance public IP address in "Host name field"
  • Make sure that Port is 22 and type is SSH
  • In the left pane, go to Connection->SSH->Auth to load your private key
  • Comme back to the Session pane
  • you probably want to save your parameters : enter a session name in "Saved sessions" field and click "Save"
  • click Open
  • do whatever you want with the security alert
  • enter your user name

You may start working !