How to Connect to ec2 Instance From Putty and SSH Terminal

How to Connect to ec2 Instance From Putty and SSH Terminal

Connect ec2 instance via ssh for window, mac and linux user. Here, we will show you two way to connect your aws ec2 instance via ssh.

Here, we will teach you two ways to connect ec2 instance via ssh using putty and terminal for window, mac and linux user.

Connect to ec2 Instance Via SSH

Use the below given two ways to connect your ec2 instance via ssh:

  • Connect to EC2 Instance SSH Mac OS & Linux
  • Connect to EC2 Instance using Putty (pem file)

Connect to EC2 Instance SSH Mac OS & Linux

First of all, you need to change the PEM file permission. And need to set it 400.

So, Open your terminal and run the below command to change the permission

chmod 400 **/path/to/your/key/filename.pem

Next, Run below command to connect with EC2 instance

ssh -i /path/to/your/key/filename.pem [email protected]

Here ubuntu is the default usrename created by aws. Change IP address string with your ipaddress. You can find this under EC2 instance.

Connect to EC2 Instance using Putty (pem file)

In this way, first of all, you need to install putty into your windows system. So visit the following url https://www.putty.org/ and download and configure putty in window.

1. Converting .pem file to .ppk file using puttygen

Now, Open puttygen.exe and load the private key (pem file). You was got, When you created the instance ec2 instance .

So click on load buttuon and save the .ppk file in any folder as you want.

2. Connecting to Ubuntu using SSH client putty

So go to window navigation bar and search putty. And click on putty software.

After that, one popup window will open.

Now, type host name or IP (public or elastic ip)  as shown in the below picture:

Then navigate to connection–>data and type in the add user name.

User name differs for different instance types.

  • For Ubuntu the default user name is ubuntu
  • For RHEL and Amazon Linux instance the default user name is ec2-user
  • For SUSE instance the default user name is root.

After that, navigate to SSH–>Auth click on Auth. And load the .ppk file you generated using puttygen in above steps.

Finally, Click open button and connection will be established. The putty terminal shown is a connection established using username “ubuntu“. 

Thanks for reading this post, now you have successfully connected with the EC2 instance.

AuthorAdmin

My name is Devendra Dode. I am a full-stack developer, entrepreneur, and owner of Tutsmake.com. I like writing tutorials and tips that can help other developers. I share tutorials of PHP, Javascript, JQuery, Laravel, Livewire, Codeigniter, Vue JS, Angular JS, React Js, WordPress, and Bootstrap from a starting stage. As well as demo example.

Leave a Reply

Your email address will not be published. Required fields are marked *