Log into the EC2 instance
Linux / Mac instructions
From your local machine, run the following commands:
LocalMac:mykeys localuser$ chmod 600 MyPrivateKey.pem
LocalMac:mykeys localuser$ ssh -i MyPrivateKey.pem ec2-user@<public ip>
- MyPrivateKey.pem: Locate the directory containing your private key, which you downloaded when creating your Key Pair.
- chmod: SSH requires strict access on the private key.
- ssh: You log into the server using the private key as the identity (
-i
)
Windows instructions (PuTTY)
PuTTY does not natively support the PEM format that AWS uses, so you need to first convert your .PEM file to a PuTTY
Private Key file (.PPK
). To do this, you use the PuTTYgen utility packaged with PuTTY.
- Open PuTTYgen and click Load to browse for your .PEM key. When browsing for the key, be sure to select All Files in the dropdown menu. Click Open when you have selected your key.
- PuTTYgen will now convert your key to the proper filetype.
- To save your new PPK key, click Save private key.
You are now ready to SSH in to the server with PuTTY using the new .PPK key.
- Open PuTTY and select SSH as the connection type.
- In the Host Name field, enter
ec2-user@<public ip>
- Expand the SSH section on the left, and click on Auth.
- Click on Browse to browse for the .PPK key, and click Open when you have selected it.
- To launch the SSH session, click Open.