- Login/SSH to AWS Linux EC2 instance
- You already have a Linux EC2 instance running in AWS and port 22 is enabled for public access.
- You must have a private key like mykey.pem (Privacy Enhanced Mail).
- If you are using a Windows machine then SSH client should be installed. You can use Putty which is easy. You can download it from https://putty.org/.
SSH from Windows machine
Convert PEM to PPK file
When you install the putty you might already have puttygen installed. Hence, open it.
- Click on Load button
- Select the PEM file where you have saved in your local machine.
- Click Save Private Key button.
- Give a proper name and save it. It should save in .ppk format.
SSH from putty
- Now open the putty
- Select the Session category.
- On the Host Name (or IP address) field, type the ubuntu@yourIP if your ec2 instance is Ubuntu and ec2-user@yourIP if your ec2 instance is Amazon Linux AMI.
- Go to SSH category which is under Connection
- Expand to SSH after clicking + icon
- Click on Auth
- Click on Browse button
- Select the PPK file where you have saved earlier.
- Click open.
- You may see a small dialog to accept it if you are connecting first time. You must accept.
You should be able log in to ec2 instance.
SSH from Linux or Mac
- Locate to your PEM file.
- Give read permission to your PEM file with the command:
sudo chmod 400 mykey.pem
ssh -i mykey.pem ubuntu@yourIP
- You may need to accept if you are trying first time.
With this above step, you should be able to login/ssh to your ec2 instance.
We are able to access our ec2 instance. Now, we can start to work on our ec2 instance.