Your EC2 instance is running. Now it is time to connect to it. This is the moment where the cloud becomes real — you open a terminal on your laptop and type commands that execute on a server sitting in an Amazon data center somewhere in the world. That is what SSH makes possible.
SSH stands for Secure Shell. It is a protocol that lets you log into a remote computer securely over a network. All data sent between your machine and the server is encrypted, so no one on the network can read your commands or the server's responses. SSH is the standard way to manage Linux servers, and it is used by virtually every cloud and DevOps engineer every day.
When you SSH into an EC2 instance, you get a command-line interface — a terminal — on that remote server. You can run any Linux command as if you were sitting in front of the machine.
Go to the AWS Console → EC2 → Instances → click your instance. In the details pane, find the Public IPv4 address. It looks something like 13.234.56.78. Copy this address — you will use it in the SSH command.
Open your terminal. Navigate to where you saved your .pem key file. Run this command:
ssh -i ~/.ssh/my-key.pem ec2-user@13.234.56.78
Replace 13.234.56.78 with your actual instance public IP. The default username for Amazon Linux is ec2-user. For Ubuntu AMIs it is ubuntu. For Debian it is admin.
The first time you connect, SSH will ask you to confirm the server's fingerprint. Type yes and press Enter. This is a one-time security confirmation.
On Windows, you have two options. First, you can use Windows Subsystem for Linux (WSL) and run the same SSH command as above. Second, you can use PuTTY, a free SSH client for Windows. If using PuTTY, note that it uses .ppk key files, not .pem — you will need to convert your key using PuTTYgen first.
The easiest modern approach on Windows is to enable WSL (Windows Subsystem for Linux), which gives you a proper Linux terminal. Then follow the Linux/Mac steps above.
After successful connection, you will see something like this:
, #_
~\_ ####_ Amazon Linux 2023
~~ \_##### ~~ \###|
~~ \#/ ___ https://aws.amazon.com/linux/amazon-linux-2023
~~ V~' '->
~~~ /
~~._. _/
_/ _/
_/m/'
Last login: Mon Mar 17 10:00:00 2026 from 1.2.3.4
[ec2-user@ip-172-31-10-20 ~]$
That prompt [ec2-user@ip-172-31-10-20 ~]$ is your Linux shell. You are now inside a server in the cloud.
Let us run some essential commands to understand where you are and what the server looks like:
# Print current directory
pwd
# List files in current directory
ls
ls -la # detailed view with hidden files
# Change directory
cd / # go to root of the file system
cd ~ # go to home directory
cd /etc # go to the etc directory
# Show system info
uname -a # kernel and OS info
hostname # server hostname
whoami # current logged-in user
uptime # how long the server has been running
Linux has a specific directory structure. Here are the most important directories on your EC2 instance:
/ — Root of the entire file system. Everything lives under this./home/ec2-user — Your home directory. Where you land after login./etc — Configuration files for the OS and applications./var/log — Log files. Crucial for debugging./tmp — Temporary files. Cleared on reboot./usr/bin — User-installed programs and commands./opt — Optional software packages.Two of the most common tasks on a Linux server are creating files and editing them:
# Create an empty file
touch myfile.txt
# Write text to a file
echo "Hello from EC2" > myfile.txt
# Display file contents
cat myfile.txt
# Edit a file with nano (beginner-friendly editor)
nano myfile.txt
# Edit a file with vim (powerful, but has a learning curve)
vim myfile.txt
In nano, use Ctrl+O to save and Ctrl+X to exit. In vim, press i to enter insert mode, type your content, press Escape to exit insert mode, then type :wq and press Enter to save and quit.
Amazon Linux uses the dnf package manager (or yum on older versions):
# Update all installed packages
sudo dnf update -y
# Install a package (e.g., git)
sudo dnf install git -y
# Check if git was installed
git --version
When you are done working on the server, type exit or press Ctrl+D to close the SSH session. This logs you out but does NOT stop the EC2 instance. The server keeps running. To stop it, go back to the AWS console and stop the instance from there.
In Part 4, we will go deeper into Linux on EC2 — covering file permissions, user management, and how to control who can access what on your server.
Cloud computing is a domain where deep intuition — the ability to make good architectural decisions quickly, to diagnose problems efficiently, and to anticipate how systems will behave under load — develops through accumulated hands-on experience. Every project you build on cloud infrastructure teaches you something that cannot be learned from documentation alone. The cost surprises, the permission errors, the networking debugging sessions, the performance investigations — these are not obstacles to learning, they are the learning. The engineers who have built genuinely deep cloud intuition have usually accumulated it through many projects over several years, not from any single course or certification. Start building things, make mistakes safely in learning environments, and accumulate that experience deliberately.