AWS

How to SSH Into the AWS EC2 Instance Windows

SSH, a secure shell, is a network transfer protocol to link two computers to share data and transfer files. On the other hand, the Amazon EC2 instance is a virtual server in the amazon cloud to run applications’ service that uses SSH keys to ensure the secure transfer of information between server and clients.

Use the given steps to connect to the EC2 Instance’ SSH:

Step 1: Head Inside Instances From EC2 Management Console

The EC2 instance is running on an Ubuntu virtual machine. The goal of entering into the EC2 management console is to gather information about the instance we will connect:

The next step is to head inside the connect section for the EC2 instance. To do this, either right-click on the instance and then choose “connect” as shown below:


Or simply select your instance by left-clicking on it and then clicking on the connect button on the top right.

Step 2: Getting the SSH Command

When you open up the connect section, you will be bought to this page, as shown below:

On this page, you need to head inside the SSH client tab. Once inside the SSH client tab, you can see the SSH command you need to connect to your EC2 instance.

Simply copy this command into your clipboard so that you can use it later on.

Step 3: Using SSH Command From Windows

You can use either the command prompt or the windows power shell to connect to the EC2 virtual machine using the SSH command. In this guide, we’ll be using the command prompt to showcase the connection process. So, open up the command prompt and paste it on the SSH command you copied from the SSH client tab.

After that, you simply need to change the path of the pem file “12367.pem” to where you have placed your pem file.

Once that is done, simply hit enter to execute the command.

Side Information: If you want a breakdown of the SSH command, then the following is the syntax of the SSH command

ssh -i path username@ip-address

The syntax has the following keywords:

  • SSH: command to use SSH protocol.
  • i: refer to flag that uses an alternate identification file use as identification for public key authentication
  • Username: username uses your instance.
  • Ip-address: The IP address should be given to your instance
  • Path: This is the path to the .pem key file.

Step 4: Verification

A question prompt will appear when you launch your SSH command. Type yes to connect. This will recognize your host whenever you want to connect with your instance.

After typing yes, your SSH connection with EC2 will be successfully established, and the ubuntu terminal window will appear.

Now, you are successfully connected to the SSH of your EC2 instance.

Conclusion

SSH is a secure network protocol. The SSH command is used to establish this SSH connection with the EC2 instance. This SSH command requires the key-pair file associated with the instance, ip-address of the instance, and the username for that particular instance. The guidelines above explain how to connect amazon web service instances (EC2) with SSH.

About the author

Abdul Mannan

I am curious about technology and writing and exploring it is my passion. I am interested in learning new skills and improving my knowledge and I hold a bachelor's degree in computer science.