If you are looking for a way how to ssh into aws ec2 instance then this post is for you. In this post I will be showing you how to connect to AWS Instance. If you are on a windows machine you may require a software to be downloaded called as putty, which is free ssh and telnet client. Also an additional software called as puttygen will also be required. If you are on a linux or mac you can connect through ssh command.
Connecting on Windows through putty:
Step 1: Open Putty software
Step 2: Put the EC2 public ip or elastic ip or DNS name in the host name field.
Step 3: Click on SSH in left and then select auth option.
Step 4: Browse the ppk key, when you create aws instance you get a pem key, you can convert that pem key to ppk using puttygen software.
Step 5: From here you can select session on left and then you can click on save to save settings to open it quickly next time. If you do not want to save then you can directly click on Open.
Step 6: Once you click on server, if you are opening for first time you may get a pop up for key trust you can click yes and move forward, then you will be presented with a terminal to login. You can use ec2-user to login. Inorder to escalate to root, you can type sudo su.
Connecting on Linux and Mac through SSH Command:
Step 1: Make the pem file read only
chmod 400 xyz.pem
Step 2: Connect to EC2 instance using host name or ip address
ssh -i xyz.pem email@example.com
Step 3: Cache hosts popup
You will be present with key cache popup if connecting for the first like in the case of windows you have got, once you press yes you will be presented with a terminal to login.
Step 4: Escalate as root user
You are done can login using ec2-user and can escalate to root with sudo su command.
Common Issues and solutions:
- If you get an error like – ec2 ssh permission denied publickey then please either you are using wrong file or file with incorrect perm, please double check if file is correct and permission is either 400 or 600.
Please follow and like us: