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
Go to AWS Console and sign in.
Search for EC2 in the services menu.
Step 2: Launch an EC2 Instance
Click Launch Instance.
Choose an Amazon Machine Image (AMI) → Select Ubuntu (Free Tier Eligible).
Choose an Instance Type → Select t2.micro (Free Tier).
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
Rule | Protocol | Port | Source | Purpose |
SSH | TCP | 22 | My IP | Secure remote access |
HTTP | TCP | 80 | Anywhere | Allow web traffic |
HTTPS | TCP | 443 | Anywhere | Secure web traffic |
Click Review and Launch.
Download the Key Pair (important for SSH access).
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