Connecting to an EC2 Instance Using Command Prompt on Windows

Connecting to an EC2 Instance Using Command Prompt on Windows

How to Create an AWS Account

To connect to an EC2 first you need to have a registered AWS account. If you don't have an AWS account, You can register for one using this link:

How to Create an AWS Account

Creating an EC2 Instance

After creating an account, the next thing to do is to create an EC2 Instance that we would be connecting to:

How to Create an EC2 Instance

Having created your EC2 Instance, we can now have a deep dive into connecting with the command prompt for Windows and terminal for macOS.

On Command Prompt

Make sure your EC2 Instance is up and running as shown below:

Then click on Connect at the top bar Click on SSH client, then copy the command on your interface like this:

Open the command prompt and make sure you navigate to the directory where your private key was downloaded.

By default your private key should be stored in the downloads folder/directory on your computer system. but if not then you can run this command.

cd <your directory>
e.g 
cd downloads
cd documents
e.t.c

You should do something similar to this:

Then, paste the command you copied and press enter. You would have a prompt in which you are to type YES and you would be connected to your instance where you can run Linux commands and carry out other Linux Administration tasks

Now that you have been able to connect to your EC2 Instance, you can run Linux commands like:

sudo hostname webserver
sudo su - ec2-user
# To change the hostname of your EC2 Instance

I hope you found the information helpful and thanks for your time.