So weβve launched our EC2 instance β great!
π Now letβs actually explore security groups in action.
π Step 1: Viewing Security Groups from EC2
From your EC2 instance page
Go to Security tab
Youβll see: Attached security groups, Inbound rules and Outbound rules
π This gives you a quick overview, but not the full picture.
π§ Step 2: Open the Full Security Groups Page
For a deeper view:
Go to the left-hand menu
Under Networking & Security
Click on Security Groups
Now youβll see all security groups in your account.

π¦ Step 3: Understanding What You See
Youβll typically see:
Default Security Group
launch-wizard-1 (created when launching EC2)

Each security group has: π A unique Security Group ID, π₯ Inbound rules and π€ Outbound rules
π₯ Step 4: Inspect Inbound Rules
Inbound rules control who's allowed to reach your EC2 instance.
Click Edit Inbound Rules and you'll see something like:
SSH β port 22 β source
0.0.0.0/0(anywhere)HTTP β port 80 β source
0.0.0.0/0
π Step 5: Why Your Website Worked
Earlier, you accessed your EC2 using its public IPv4 address

π That worked because of this rule:
HTTP (port 80) open to the internet
π¨ Step 6: Breaking It (Very Important Learning)
β Delete the HTTP (port 80) rule

Save changes


Refresh your browser
π Result: Youβll see infinite loading / timeout

β οΈ Timeout = Security Group
Seeing a timeout β SSH, a website, an API, anything β check the security group first. It's almost always the cause.
Golden rule: Timeout = blocked by a security group.
β Step 7: Fixing the Issue
Add a new rule:
Type: HTTP
Port: 80
Source:
0.0.0.0/0ezgif-2578f0b6f2563620.mp4
Save rules
Refresh browser
β Your website works again!
βοΈ Step 8: Adding Other Rules
What you can configure
Ports: open whatever you need β HTTPS (443), a custom port like 8080, or a whole range.
Source: decide who that port is open to β
π Anywhere (
0.0.0.0/0)π§ Only your IP ("My IP")
β οΈ One catch with "My IP": it's a snapshot, not a live setting. If your IP changes later β new network, ISP reassigns it, whatever β that rule no longer matches you, and you're locked out with a timeout until you update it.
π€ Step 9: Outbound Rules
Now take a look at Outbound Rules.
By default: all traffic is allowed, going anywhere.
That's what lets your EC2 instance freely reach out β hitting the internet, installing packages, calling external APIs β without you having to configure anything extra.
π Multiple Security Groups
Important concept:
β One EC2 can have Multiple security groups
β One security group can be attached to Multiple EC2 instances
π Rules are combined together