My First Steps Learning Linux and with AWS EC2

Posted by:

|

On:

|

, , , ,

Yes, I’m only just now learning Linux. It wasn’t something covered in college, but we were told we should learn it. But I kept hearing horror stories of people accidentally breaking their system, deleting critical files, locking themselves out. That was enough to make me try and avoid it completely. I always found some excuse and work around for not having to learn Linux and I figured I could get by without it.

But now that I’ve decided to focus on cloud computing, there’s no avoiding it. If I want to work in the cloud, I need to understand Linux. It’s new territory for me, but also really exciting. I have already started learning Linux from Linux Journey and a different course which I spoke of in a previous post.

I’ve already set up a couple of AWS accounts to start learning AWS services, but before diving in too far, I wanted to get more comfortable with Linux. So I figured… why not practice both at the same time?

Experimenting with EC2 + Linux

To start, I launched an EC2 instance to run a virtual machine (VM) with Linux. I wasn’t planning to keep it running permanently, I just wanted to get familiar with the EC2 setup process and experience what it’s like to connect to a remote Linux server. Once I was done, I planned to delete the instance right away to avoid any unnecessary charges. (Yes, I’m that cautious. I’m not about to get surprised with a bill just because I forgot to shut something off during a meeting.)

I’ve dabbled with WSL before, and I’m also planning to install Ubuntu live server on an old laptop and a local Linux VM on this pc soon. Here’s how I see the different environments:

  • EC2 is great for learning AWS and Linux together. It simulates cloud infrastructure.
  • CloudShell is too limited. No sudo, no package installs, and you can’t really do network configuration.
  • WSL is convenient, but not quite the same as a full Linux environment.
  • A local VM feels like the most realistic setup—it’s isolated from the host machine and gives off that EC2-style server feel without cloud billing or latency.

Setting Up an EC2 Linux Server

I signed into my AWS account, made sure I was in the right region, and searched for EC2 in the Console. From there, I clicked Launch Instance and chose RedHat Enterprise Linux Version 10 (64-bit).

For the instance type, I selected t2.micro, since it’s small and Free Tier eligible. I named the instance “RedHat Server” and kept the default settings. When prompted, I created a new key pair and downloaded the .pem file. Once everything was set, I got a success message and clicked View All Instances to make sure the instance launched correctly.

Just a note: This key pair is used to connect via SSH. It’s not the same as the key you generate when creating an IAM user, that’s for programmatic access through the AWS CLI or SDK.

Connecting to the EC2 Instance via SSH

Since I already had WSL set up in VS Code, I first confirmed I was in the right AWS account by running:

aws sts get-caller-identity

Then I attempted to SSH into the instance. I made the key file read-only by running:

chmod 400 ~/Downloads/your-key.pem

and tried to connect using:

ssh -i ~/Downloads/your-key.pem ec2-user@<your-ec2-public-ip>

Replace <your-ec2-public-ip> with the actual IP from the EC2 instance details.


Troubleshooting the SSH Connection

Of course, I immediately ran into an error:

chmod: cannot access '/home/name/Downloads/your-key.pem': No such file or directory

Turns out I had the wrong filename or path. I ran:

ls /mnt/c/Users/savet/Downloads/*.pem

to check the actual file, then updated the path to:

chmod 400 /mnt/c/Users/savet/Downloads/red-hat-server.pem

When I tried to SSH again:

ssh -i /mnt/c/Users/savet/Downloads/red-hat-server.pem ec2-user@54.85.89.200

I still had issues. So I moved the key file into my WSL home directory with:

cp /mnt/c/Users/savet/Downloads/red-hat-server.pem ~/
chmod 400 ~/red-hat-server.pem

Then tried connecting again:

ssh -i ~/red-hat-server.pem ec2-user@54.161.84.7

This time, I got the usual warning:

The authenticity of host '54.161.84.7' can't be established...

That’s totally normal the first time you connect to a new EC2 instance via SSH. I typed “yes” to continue.


Success! I am in!

Eventually, I made it in. I was greeted with a fresh Linux shell:

[ec2-user@ip-172-31-92-243 ~]$

I checked system info by running:

uname -a

Which returned:

Linux ip-172-31-92-243.ec2.internal 6.12.0-55.18.1.el10_0.x86_64 ...

Then I ran updates with:

sudo dnf update

It listed that it would install 4 new packages and upgrade 26. Everything worked as expected.

To safely exit the SSH session, I just typed:

exit

And I was returned to my local WSL terminal.

Why I Did This

Even though I can already run Linux commands inside WSL or on a Linux playground, I wanted to experience what it’s like to create and connect to a real Linux server running in the cloud. This isn’t just about learning terminal commands, it’s about understanding how Linux actually fits into real cloud environments like AWS.

There are lots of ways to connect to EC2: WSL, a local VM, or tools like MobaXterm. My next step is to download and set up a local Linux VM so I can practice commands in an isolated, realistic environment, without worrying about cloud billing or connection issues. I am also thinking about trying dual boot.

Final Thoughts

This was just my first real experiment with Linux and EC2. It took a few tries and a few small errors, but I got it working. I’m no longer afraid of Linux and found that it is actually enjoyable. I respect it now and I’m genuinely excited to learn more. If you are intimated about learning Linux, don’t be. Go ahead and jump right in. There are ways around practicing Linux that can protect your system while you learn. Don’t be like me and put it off until you absolutely can’t anymore.

I also recently started working on launching an Ubuntu live server on an older laptop as part of a personal project. I’ll be posting about that experience soon, so if you’re curious about how that goes, stay tuned.

More updates coming as I go deeper into the Linux world and eventually beyond, into the full world of AWS!