Day 4: AWS EC2

satyam mishrasatyam mishra
3 min read

Deep Dive into EC2 – Ports, IPs, SSH Users, and More

Okay, I thought I was kind of done with EC2 after installing both NGINX and Apache... but turns out, there’s still a lot left to play with. Today, I went a little deeper into EC2 — not just launching instances, but actually exploring how networking and users work.

It was all stuff that seemed “extra” before, but now I’m realizing it’s essential. Here’s what I messed with today:


1. Playing with Security Groups and Ports

I started by modifying the Security Group of my EC2 instance. My goal: see what happens when I open or close ports manually.

Things I tried:

  • Removed port 80 → Website became unreachable

  • Re-added it → Site came back online

  • Opened port 3000 to prepare for a future app

  • Opened port 22 to SSH from another device

I also restricted port 22 to my IP only — a security best practice I had no idea about until now.


2. Creating a New SSH User on EC2

This part was fun. I created a new Linux user:

sudo adduser devuser

Now I could SSH into the instance as devuser, not just ec2-user. Felt more "real world".


3. Understanding Sudo Permissions

By default, the new user couldn’t use sudo, so I added it:

sudo usermod -aG wheel devuser

Then I switched to devuser and tested it:

sudo ls

It worked!
I'm slowly understanding how Linux users and permissions work inside EC2.


4. Static IPs: Why I Need an Elastic IP

Here’s something that tripped me up.

When I stopped and started my EC2 instance, its public IP changed 😬
That meant I had to update my browser or SSH every time.

Solution? Elastic IPs.
So I:

  • Went to EC2 > Elastic IPs

  • Allocated a new one

  • Associated it with my running EC2 instance

Now I have a fixed IP I can use — much better for a blog or app.


5. Understanding the EC2 Lifecycle

I played with the EC2 stop/start/reboot/terminate buttons.

Observations:

  • Stop → Start: Data persisted, but IP changed (until I used Elastic IP)

  • Reboot: Quick restart, data safe

  • Terminate: Wipes everything — like formatting your PC. Scary, but good to know.


6. Installing Extra Tools on EC2

Since it’s just Linux, I figured — why not install something?

I tried:

sudo dnf install git -y
sudo dnf install python3 -y

Both worked great.
This EC2 instance is starting to feel like my personal dev playground now.


What I Learned Today

  • Security groups are like EC2 firewalls — powerful but simple once you get them

  • I can manage users and SSH just like a regular Linux box

  • Elastic IPs are a must if I want a stable setup

  • I now understand the difference between reboot, stop, and terminate

  • EC2 is more than "just a server" — it's a mini-data center at my fingertips

0
Subscribe to my newsletter

Read articles from satyam mishra directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

satyam mishra
satyam mishra