Mastering AWS EC2 Security Groups & Essential Networking Commands 🚀

Mastering AWS EC2 Security Groups & Essential Networking Commands 🚀

Day - 3 of #90DaysOfDevOps Challenge

Introduction

Whether you're launching your first AWS EC2 instance or troubleshooting network issues, mastering Security Groups and networking commands is crucial. In this guide, we’ll cover:

✅ How to launch an AWS EC2 instance
✅ How to configure Security Groups for secure access
✅ A cheat sheet of essential networking commands

🟢 Part 1: Launching an AWS EC2 Instance

Step 1: Login to AWS & Navigate to EC2

  1. Go to AWS Console and sign in.

  2. Search for EC2 in the services menu.

Step 2: Launch an EC2 Instance

  1. Click Launch Instance.

  2. Choose an Amazon Machine Image (AMI) → Select Ubuntu (Free Tier Eligible).

  3. Choose an Instance Type → Select t2.micro (Free Tier).

  4. Click Next: Configure Security Group.

🟢 Part 2: Understanding Security Groups

Security Groups in AWS act as firewalls that control inbound & outbound traffic.

Step 3: Configure Security Group Rules

RuleProtocolPortSourcePurpose
SSHTCP22My IPSecure remote access
HTTPTCP80AnywhereAllow web traffic
HTTPSTCP443AnywhereSecure web traffic
  1. Click Review and Launch.

  2. Download the Key Pair (important for SSH access).

  3. Click Launch Instance.

Done! Your EC2 instance is now live.

🟢 Part 3: Essential Networking Commands Cheat Sheet

1️⃣ ping - Check Network Connectivity

bashCopyEditping google.com

✅ Tests if a host is reachable.

2️⃣ traceroute / tracert - Trace Packet Routes

bashCopyEdittraceroute google.com  # Linux/macOS
tracert google.com  # Windows

✅ Shows the path packets take to reach the destination.

3️⃣ netstat - View Network Statistics

bashCopyEditnetstat -an

✅ Displays active connections & listening ports.

4️⃣ curl - Make HTTP Requests

bashCopyEditcurl -I https://example.com

✅ Fetches HTTP headers of a website.

5️⃣ dig / nslookup - DNS Lookup

bashCopyEditdig google.com  # Linux/macOS
nslookup google.com  # Windows

✅ Resolves a domain name to an IP address.

🔹 Conclusion

By understanding AWS EC2 Security Groups and mastering networking commands, you can:
✅ Secure cloud instances properly
✅ Debug connectivity issues efficiently
✅ Improve your DevOps & cloud skills