Accessing Your EC2 From Windows Machine.
How to Access Your EC2 Instance from a Windows Machine: A Step-by-Step Guide

In our last blog, we created our first EC2 instance. Now, we’ll explore how to access it from a Windows machine . We'll start by accessing it or by connecting it to our windows machine. This will allow us to Run Commands, Manage file, Install Software, Configure Services and Monitor System. 🖥️
Before starting, there are some prerequisite you must follow :
• Windows 10 or above / Linux : Windows 10 and later come with an OpenSSH client that we can use via Command Prompt. Which means that if you have Windows 8 or lower, you'll have to either use PuTTY for SSH Access or convert PEM key to PPK.
• Running Instance : The obvious one as you'll need an running instance in the first place to Access it from your machine.
4 Ways To Access EC2 :
There are numerous ways to access our instances, but we will focus on the three most commonly used and straightforward methods:
1 - Instance connect
2 - CMD
3 - Bash
• Instance Connect
Using Instance connect we can access our instance without needing to manage SSH key or configure rules for our instance, It simplifies the process of connecting to our instances for administrative purpose. Also when we use Instance connect, a one-time-use SSH key is generated and sent to the instance. This key is Valid for a short period. 🔑
To use Instance Connect:
Go to your EC2 instances and click on Connect.
The connect window will open, allowing us to access our instance

The Following window will pop up, the EC2 instance connect is the easiest way to connect to our instance, By simply clicking on connect - we can connect to our Amazon EC2 instances using a web-based SSH client directly from the AWS Management Console.

And just like that we have our web-console open to access our instance 🚀

CMD :
For the second method, we’ll use CMD to access our instance from a Windows machine. Here’s how: 🐱🏍
Navigate to the file location of your
.pemkey.In the address bar of the file explorer (e.g.,
C:\Users\PC\Downloads), typecmdand press Enter. This opens the Command Prompt directly in the directory where your.pemfile is located. See how we are directly into theC:\Users\PC\Downloadsdirectory.

After opening cmd, we'll go back to the connect menu > SSH client. Copy the example and paste it in the CMD console,
Here's a format of the command :
ssh -i "FileName.pem" ubuntu@ec2-52-66-200-47.ap-south-1.compute.amazonaws.com
You can simply find it in the "connect to instance" in the SSH client option menu.

Paste the code in cmd and press enter, you'll get an option to continue or not - simply type yes and press Enter.

Just like that we are now in our instance, you can see that there are all these specs mentioned below. We can see the memory usage, IP address, System load etc. 📊
Now, we'll run some simple commands to check the status of all the resources we have added and how are they running in our instance.

Syntax : cat /etc/os-release
It displays information about the operating system (OS) release installed on the EC2 instance. it also shows the name and version of the OS, which helps identify the specific OS distribution and version running on your instance.👁🗨

Another command is free -m , It is used to check the total memory usage in megabytes(MB), provides information about total available memory (RAM) and how it is currently allocated, including used, free, and cached memory. This command helps monitor the memory consumption of our instance. 📑
the " Mem: " below, show us the total memory that we got assigned (approx. 1GB)

The lscpu command provides detailed information about the CPU architecture of your system🕸, including details about the CPU caches.
L1d Cache: Level 1 Data Cache, very fast, stores frequently accessed data.
L1i Cache: Level 1 Instruction Cache, very fast, stores frequently executed instructions.
L2 Cache: Intermediate cache that stores data and instructions, larger but slower than L1.
L3 Cache: Largest and slowest of the three, shared among all CPU cores, reduces memory access latency.

The df -h command is used to display information about disk space usage in a human-readable format. This shows information about disk space utilization across different filesystems mounted on the instance. It includes details like total disk space, used space, available space, and percentage usage for each filesystem. 💾

The ip a command displays information about network interfaces and their associated IP addresses, states and configuration. The highlighted part is the Private IP address of the instance .🛣

Bash :
If you have a window machine that doesn't support SSH commands, you can either use PuTTY as mentioned earlier or use Git Bash,
Using Bash is also a very easy way to gain the access to our instance . we can change directories using cd command or right click in the "downloads" folder and click on open bash here. 👨💻

Conclusion
Congratulations! You’ve successfully connected to your EC2 instance using different methods. Now you can run commands, manage files, install software, configure services, and monitor your system.
Thank you for following along with this Blog 🙋♂️. If you found this guide useful, please check out other blogs as well.
If you have any questions or run into any issues, feel free to leave a comment or reach out .
Happy cloud computing! 🚀



