Connect AWS EC2 via SSH on Windows
Amazon Web Services (AWS) provides EC2 Service for Cloud Developers where they can have Virtual Machines, deployed on Cloud, which can host their Applications. With the flexibility of choosing an appropriate Instance Family and the Instance Size, EC2 is increasingly being used for general-purpose hosting and big data processing which is more CPU-intensive. In this article, we will check out on how we can connect AWS EC2 via SSH on Windows.
Elastic Cloud Computing better is known as EC2, has been high in demand especially among Developers who don’t have much knowledge regarding Cloud, to get started with deploying and hosting their applications. With an intuitive UI/UX and a large set of documentation and community support, you can easily get started with EC2, where we just need to invest in the hardware upfront.
With EC2 you can also scale up and downwards and configure Security, Networking and finally your Storage Options directly using a Web Browser without, opening your shell. In this article, we are going to discuss on how you can setup an AWS EC2 instance and setup a SSH connection using your Windows Operating System.
Setting up the AWS EC2 Instance
If you have not already, set up your AWS Account, make sure to activate it. A newly created AWS Account take almost 24-hours to activate so make sure to get it activated before you follow up with the tutorial.
Step 1: Setting up the Root Account
First setup your Root Account, by going to the AWS Management Console. It will ask your E-Mail Address and the Password before proceeding further.
Step 2: Go to the AWS EC2 Dashboard
Go to the AWS EC2 Dashboard and launch the Instance.
Click on “Launch Instance” and you will land on the first step that you need to configure while launching an Instance. You now need to select an Amazon Machine Image (AMI) which will be the base operating system for your Virtual Machine.
Step 3: Choose the Amazon Machine Image (AMI)
Since we are following a demonstration, we will go for a “Free-Tier Eligible” AMI to get started with. I will be using an Ubuntu Server since it is massively popular and open-source. Click on “Select” and you will land on the second step where you will be choosing an Instance Type. This will be used to connect to your Instance via the SSH.
Step 4: Choose the Instance Type
Next you will be choosing an Instance Type. The Instance Type would directly influence the Storage Capacity along with the Network Performance that your Application would have. For now we will go for a “General Purpose” family whose type is “t2.micro” which is Free-Tier available as well. You can now click on “Next: Configure Instance Details”.
Step 5: Configuring Instance Details
We can leave the default settings here for demonstrative purposes and move forward, by clicking “Next: Add Storage”.
Step 6: Adding Storage
You can add the Storage here which is set at a default 8 GB size now. You can either upscale it or downgrade it as per your requirements. You can also configure the Volume Type and the Encryption. For now we will just move ahead with the default settings and work on adding tags to our EC2 instance.
Step 7: Add Tags
The Tags consists of sensitive Key-Value Pair and hence you need to be careful while putting them up as they are applied on all instances and volumes associated with the EC2 instance. Click on “Next: Configure Security Group” to move ahead.
Step 8: Configure Security Group
You can now add Security Groups through which your application can be accessed. You need to make sure that you have a SSH type available so that you can access it via your Local System later. Click on “Review and Launch” to move further.
Step 9: Launch and download the Keys
Once you click on “Click” you will be prompted to select either an existing key-pair or a new key pair. Using this Key Pair you can SSH into your Virtual Machine. We will create a new key-pair and name it “devmeet-demo” for our convenience. Once done, we will launch the Instance.
Accessing your EC2 Instance
Now that you have launched your EC2 Instance, the next step that comes is accessing your EC2 Instance. To do that, we will make use of the Key-Pair that we have downloaded earlier. On the new page, you will be shown that your instances are now launching. Click on “View Instances” to check out your Instance up and running.
Step 1: Connect your AWS EC2 Instance
Click on Connect. You will see a pop-up with a detailed instruction on how you can connect to your EC2 instance. You can now either connect via a SSH Tool like Putty or you can do the same via Git Bash. We will be using Git Bash in our tutorial for this.
Step 2: Locate the Key-Pair
Locate the Key-Pair and keep it safely in a folder. Once done, open your Git Bash and push in the command:
$ chmod 400 devmeet-demo.pem
You can replace ‘devmeet-demo’ with the name of your Key-Pair. This command will ensure that the key is not visible publicly.
Step 3: Connect to your Instance
To do the same, you need to push in the command:
ssh -i "devmeet-demo.pem" firstname.lastname@example.org
You can replace “devmeet-demo.pem” with the name of your Key-Value Pair while you can replace “email@example.com” with your own public DNS. Once done, you will see the following screen:
We have successfully accessed our EC2 instance now which is running on an Ubuntu Virtual Machine. You can now pass standard Linux Commands for your purpose.
In this tutorial we covered on how you can create an EC2 Instance using AWS EC2 Management Console and launch an Instance with all configurations set. Lastly, you have also seen on how you can directly connect to your EC2 instance via Git Bash.
Suggested Article – DevOps with AWS
Want to get regular updates of Free Courses, Internships & Job Opportunities and Technical Blogs to enhance your knowledge then join Dev Meet Telegram Channel or WhatsApp Group from below links
Connect AWS EC2 via SSH on Windows