Connecting AWS EC2 using SSH
August 17, 2018
When you are creating the EC2 instance, you have downloaded a key pair (.pem) from AWS.
If you are a Mac user, it is easy:
1). Go to the path where the pem file locates
2). Run “chmod 400 <key file name>.pem” to make sure the key file is set to be private (Can only be viewed by you)
3). Connect to EC2 using the key file
“ssh -i <key file name>.pem ec2-user@<EC2 public IP>”
If you are a Window user, a little trick is needed:
- Download the “puttygen.exe” – I have packed puttygen.exe & putty.exe in a zip file: HERE
You may download the latest version from the official web site: https://www.putty.org/
- Go to the directory where your key file (,pem) file locates,
- Go to the directory where your key file (,pem) file locates, then look for “All Files”
- Open the key file (.pem) file
- Hit “OK” to proceed
- Click “Save private key” as (.ppk) file – it is the key file format using Putty for SSH connection
- Click “Yes” to proceed
- Name your key file and ******save it as .ppk file (IMPORTART)
- The key file is now ready, check the public IP of your EC2 (e.g. 13,231,165,55)
- ALSO check the Security Groups of your EC2 and make sure that the INBOUND RULE for “Port 22” has been set to Public (0.0.0.0/0) *** IMPORTANT
- Open “Putty” and Go to “Connection -> SSH -> Auth” and browse your key file (.ppk) file
- Go to “Session”, enter host name “bitnami@<your EC2 public IP>” – bitnami is the default login username for Bitnami WordPress EC2 AMI. When you are creating your own EC2 instance, default username will then be “ec2-user”.
Save your session in case you need to log on to your EC2 using SSH later on
- DONE!!!