A Beginner's Guide to Computer Networking

Table of contents
- ๐ง What is Computer Networking?
- ๐ค Why Networking Matters in DevOps?
- ๐ How Does the Internet Work?
- ๐ Step-by-Step Internet Journey
- ๐ง Try It Yourself (Practical Commands)
- ๐ง The OSI Model
- ๐ฎ Imagine This:
- ๐ OSI Layers Mnemonic:
- ๐ผ Layer 7: Application Layer โ โLetโs Play!โ
- ๐จ Layer 6: Presentation Layer โ โGraphics, Sounds, and Securityโ
- ๐ Layer 5: Session Layer โ โLetโs Connectโ
- ๐ฆ Layer 4: Transport Layer โ โSend It Reliablyโ
- ๐ฐ๏ธ Layer 3: Network Layer โ โFind the Wayโ
- ๐ Layer 2: Data Link Layer โ โLocal Deliveryโ
- ๐งฑ Layer 1: Physical Layer โ โThe Real Wiresโ
- ๐ Software vs Hardware in OSI Model
- ๐งต Final Summary: Gaming the OSI Model
- ๐ TCP/IP Reference Model
- ๐ IP Address & Subnets
- ๐ฅ๏ธ Why Do Devices Need IP Addresses?
- โ๏ธ AWS Networking Essentials: VPC, Subnets, Security Groups, NAT & DNS
- ๐ง What is a VPC?
- ๐งฉ VPC Structure Breakdown
- ๐ IP Addressing Inside VPC
- ๐ฅ What is a Security Group (SG)?
- ๐ Example: Allow Only Your PC to SSH
- ๐ฅ๏ธ Connecting to EC2 Using Public IP
- ๐ Live Webpage Hosting on EC2 (Ubuntu)
- โ Canโt Access Page? Firewall (SG) is Blocking
- ๐ What is NAT?
- ๐ DNS: Domain Instead of IP
- ๐ง OSI Model Behind the Scenes (Quick Review)
- โ Summary
- โ๏ธ AWS VPC Networking โ Subnets, NAT, Gateways, and Route Tables
- ๐ First, Some Handy CLI Commands
- ๐ What is a VPC (Virtual Private Cloud)?
- ๐ก๏ธ Where to Keep Your Database?
- ๐ How App (Public Subnet) Talks to DB (Private Subnet)?
- โ Solution: Use NAT Gateway
- ๐ But... How Does a User Access My App?
- ๐งญ What is a Route Table in VPC?
- ๐ Full Traffic Flow: End-to-End Example
- ๐ถ Bonus: VPC Peering
- โ Summary Table
- โ๏ธ What is a Load Balancer? โ With AWS Perspective

๐ง What is Computer Networking?
Letโs imagine this:
There are 5 cities โ C1, C2, C3, C4, and C5.
These cities are connected by roads.
You can travel between cities using a car.
Now, imagine:
Cities = Computers
Roads = Network
Car = Data
โก๏ธ So, Computer Networking is like building roads between cities so that cars (data) can travel from one city (computer) to another.
In simple terms:
Computer Networking is a system where multiple computers are connected to share data, files, and resources like printers or the internet โ either via wires (cables) or wireless means.
๐ค Why Networking Matters in DevOps?
As a DevOps Engineer, your job involves working with servers, cloud systems, and automations.
๐งฐ So why is networking important?
You often transfer files between servers.
You need to configure firewalls, load balancers, DNS records, and monitor traffic.
You might have to SSH into a remote machine, which is part of a network.
In short, you canโt do DevOps without a good grip on networking.
๐ How Does the Internet Work?
Letโs make this super simple:
๐ฌ Example: Youโre watching Netflix in India But Netflix's main servers are in the USA. So how does your request reach them?
You might imagine that data travels through satellites. Yes, thatโs possible, but itโs slow due to the distance.
โ Real Answer: Undersea Optical Fiber Cables Oceans are filled with underwater fiber cables โ these cables carry data at high speed and low latency.
So when you visit www.netflix.com, hereโs what happens:
๐ Step-by-Step Internet Journey
You type a website (e.g., www.netflix.com) in the browser.
The request goes out using a protocol: HTTP or HTTPS.
HTTP (HyperText Transfer Protocol) sends webpages.
HTTPS is the secure version (with encryption).
Butโฆ how will the internet know where Netflix is?
Thatโs where DNS (Domain Name System) comes in.
๐ DNS works like a phonebook:
You ask it: โWhere is www.netflix.com?โ
It replies: โHereโs the IP address: 198.123.45.67.โ
๐ The IP address is where Netflix's server lives โ in the USA.
Your request travels through routers, ISPs, and cables...
Your Device โ Router โ ISP (like Jio, Airtel) โ Submarine Cables โ Netflix Server
Netflix sends video data back the same way to your browser โ and voilร , your movie starts!
๐ง Try It Yourself (Practical Commands)
๐ Trace the Route
See how your request travels across the internet:
traceroute netflix.com # On Linux/macOS
tracert netflix.com # On Windows
This will show:
Your routerโs IP
ISP nodes
International jumps
And finally, the destination (Netflix)
๐ถ Check Connection
Use ping to see if you can reach a server:
ping google.com
It sends small packets to Google and shows if itโs reachable and how long it takes (latency).
๐ง The OSI Model
OSI (Open Systems Interconnection) Model is a framework that standardizes how data is transferred between two systems over a network.
It has 7 layers, each with a specific role in ensuring smooth, secure, and reliable communication.
๐ฎ Imagine This:
Two friends, A and B, are playing a multiplayer online game from different countries.
Letโs use this scenario to understand how the OSI Model works.
๐ OSI Layers Mnemonic:
All People Seem To Need Data Processing
(Application โ Physical)
๐ผ Layer 7: Application Layer โ โLetโs Play!โ
This is where A and B run the actual game app (e.g., PUBG, Fortnite).
This is the interface between the user and the network.
They use a browser or mobile app.
Protocols: HTTP, HTTPS, FTP, SMTP
๐ก In DevOps, you work with these protocols while managing servers and web apps.
๐จ Layer 6: Presentation Layer โ โGraphics, Sounds, and Securityโ
A and B are seeing graphics, using keyboard, listening to game sounds, and the data is encrypted.
It manages how the data is presented: format, encoding, encryption.
It converts data to be readable by the receiver.
Also responsible for SSL/TLS encryption (important in HTTPS).
๐ก๏ธ Think of this as the syntax and security formatting of the data.
๐ Layer 5: Session Layer โ โLetโs Connectโ
Before playing, a connection is established between A and B (like a game lobby).
This layer establishes, maintains, and ends communication sessions.
Responsible for authentication and session management.
๐ง Examples:
API sessions: when apps talk to each other (e.g., payment gateways).
Sockets: used for real-time communication like chat, games, etc.
๐ API: Bridge between two apps (e.g., Google Maps inside Zomato app)
๐ Socket: Real-time data channel (e.g., online multiplayer game, live chat)
๐ฆ Layer 4: Transport Layer โ โSend It Reliablyโ
The game data like movements, actions, chat is now broken into packets and sent between A and B.
- Responsible for reliable delivery, error checking, and flow control.
Protocols:
TCP (Transmission Control Protocol) โ Reliable, connection-based
UDP (User Datagram Protocol) โ Faster but no guarantee (used in live games, video calls)
๐งช Youโll hear this in DevOps when setting up ports, firewalls, or troubleshooting connection issues.
๐ฐ๏ธ Layer 3: Network Layer โ โFind the Wayโ
A and Bโs data has to travel across the globe. So it needs routing.
Responsible for IP addressing and routing.
It finds the best path for data.
Protocol: IP (Internet Protocol)
๐ Example: Your request goes from India to the US via routers using IPs.
You can trace this using:
traceroute google.com # Linux/macOS
tracert google.com # Windows
๐ Layer 2: Data Link Layer โ โLocal Deliveryโ
Now the data is being transferred within the same local network (e.g., from your laptop to your WiFi router).
Deals with MAC addresses, frames, and error detection.
Ensures data is sent to the right device on a local network.
๐ You can check your MAC address using:
ip link show
๐งฑ Layer 1: Physical Layer โ โThe Real Wiresโ
Finally, all of this data flows through real hardware โ like fiber optic cables, network cards, or WiFi signals.
- Transmits 0s and 1s (binary data) over physical medium (cables, radio waves).
Includes: Cables, Switches, Hubs, Connectors, NICs.
๐ก Without this, the internet wouldnโt exist physically.
๐ Software vs Hardware in OSI Model
Layer | Handled By |
Application to Session (7โ5) | Software (Apps, APIs, OS services) |
Transport to Physical (4โ1) | Hardware + OS + Network tools |
๐งต Final Summary: Gaming the OSI Model
Layer | Game Analogy | Real Function |
7. Application | Running the Game | Interface for user apps |
6. Presentation | Graphics & Encryption | Data formatting, encryption |
5. Session | Connection Setup | Session control (API/Sockets) |
4. Transport | Sending Actions | Reliable data delivery (TCP/UDP) |
3. Network | Global Routing | IP addressing and routing |
2. Data Link | Local Network | MAC address & local delivery |
1. Physical | Hardware/Signals | Cables, NICs, electrical signals |
โ Ready for DevOps?
OSI is more than theory. Youโll use it when:
Configuring ports (Layer 4)
Understanding IP routing and DNS (Layer 3)
Managing VPNs and proxies
Debugging with ping, traceroute, netstat, tcpdump, etc.
๐ TCP/IP Reference Model
โ What is the TCP/IP Model?
The TCP/IP Model (Transmission Control Protocol / Internet Protocol) is the framework used in real-world networks, including the internet.
๐ง Fun Fact:
It was developed by the U.S. Department of Defense.
Itโs more practical than OSI.
The entire internet works using this model!
๐ข TCP/IP vs OSI โ Layer Comparison Table
TCP/IP Model | OSI Model | Description |
4๏ธโฃ Application Layer | OSI Layers 7, 6, 5 (App, Pres, Sess) | User-facing services like HTTP, FTP, DNS |
3๏ธโฃ Transport Layer | OSI Layer 4 (Transport) | Ensures data delivery (TCP/UDP) |
2๏ธโฃ Internet Layer | OSI Layer 3 (Network) | IP addressing and routing |
1๏ธโฃ Network Access | OSI Layers 2 & 1 (Data Link, Physical) | Deals with MAC, switches, physical data transfer |
๐ Layer-by-Layer Explanation
๐ผ 1. Application Layer (Userโs World ๐)
Combines Application + Presentation + Session (from OSI)
This layer is where users interact โ web apps, emails, file transfers, etc.
๐ ๏ธ Protocols:
HTTP/HTTPS โ Browsing websites
FTP โ File transfers
SMTP/POP3/IMAP โ Emails
DNS โ Resolving domain names
SSH โ Securely accessing remote machines
๐ก DevOps relevance:
You deploy web apps via HTTP
Use DNS to map domains
Use SSH daily to connect to servers
๐ 2. Transport Layer (Data Delivery ๐ฆ)
Same as OSI Layer 4
This layer is responsible for reliable or fast delivery of data between systems.
๐ ๏ธ Protocols:
TCP โ Reliable, ordered, connection-based
UDP โ Fast, connectionless (e.g., video calls, gaming)
๐ก DevOps relevance:
Use TCP for SSH, HTTPS, etc.
Understand port numbers (like 80 for HTTP, 443 for HTTPS)
Configure firewalls and load balancers on this layer
๐ฐ๏ธ 3. Internet Layer (IP & Routing ๐)
Matches OSIโs Network Layer
This layer decides how to send data from one device to another across networks.
๐ ๏ธ Protocols:
IP (Internet Protocol) โ Assigns addresses
ICMP โ For diagnostics (used by ping)
ARP โ Finds MAC address from IP
RIP/OSPF/BGP โ Routing protocols
๐ก DevOps relevance:
IP configuration, subnetting
ping, traceroute, netstat, and ip commands
Setting up routing between VPCs in AWS
๐ 4. Network Access Layer (Local Network Transfer ๐งฑ)
Combines OSI Layers: Data Link + Physical
Handles local delivery within the same network โ like your PC to WiFi router.
๐ ๏ธ Technologies:
Ethernet, Wi-Fi
Switches, Cables, Network Interface Cards (NIC)
MAC addresses
๐ก DevOps relevance:
Identify NICs
Work with MAC/IP mapping
Monitor hardware-based issues
๐ End-to-End Flow Example
๐งโ๐ป User A wants to open www.example.com
Application Layer: Browser sends HTTP request
Transport Layer: Data broken into TCP segments
Internet Layer: Adds IP header to route packets
Network Access Layer: Frames sent via Ethernet/Wi-Fi to local router
๐ Final Tip for DevOps Learners
Think of the TCP/IP model not just as theory, but as a troubleshooting tool.
If something goes wrong:
Is the domain not resolving? โ DNS issue (Application layer)
Canโt connect to server? โ Port or firewall (Transport layer)
Packet not reaching? โ Routing (Internet layer)
No connection at all? โ Cable/Wi-Fi issue (Network Access layer)
๐ IP Address & Subnets
๐ฆ What is an IP Address?
Imagine your device (laptop, phone, etc.) as a house, and the internet is the global postal service.
Just like each house needs a unique address to receive letters, every device needs a unique IP address to send and receive data.
๐ง Definition:
- An IP address (Internet Protocol address) is a unique identifier assigned to a device connected to a network so it can communicate with other devices.
๐ฅ๏ธ Why Do Devices Need IP Addresses?
Today, we have a variety of smart devices:
๐ฑ Smartphones
๐ป Laptops
๐บ Smart TVs
โ Smartwatches
๐ Tablets
โก๏ธ Each of them must be uniquely identifiable on the internet or local network. Without an IP address, the internet wonโt know where to send the data.
๐ฌ IP = Digital Home Address for devices
Used by the TCP/IP model (real-world) and also fits into OSI Layer 3 (Network Layer)
๐งฎ Types of IP Address Versions
๐ IPv4 โ Internet Protocol Version 4
Format:
192.168.1.1
Uses 32 bits = ~4.2 billion addresses
โ Widely used today
โ Problem: Not enough IPs for all devices on Earth
๐ IPv6 โ Internet Protocol Version 6
Format:
2001:0db8:85a3:0000:0000:8a2e:0370:7334
Uses 128 bits = 340 undecillion IPs (massive!)
โ Solves the address limitation
โ Still not adopted fully everywhere (IPv4 still dominates)
๐คฏ So Whatโs the Problem With IPv4?
There are only about 4.2 billion IPv4 addresses. But with billions of people and multiple devices per person, we ran out fast!
Imagine if every device needed a real internet-facing IP, weโd have been done by now!
๐ก Whatโs the Solution? โ Subnets & Private IPs
๐ Solution 1: Private Networks + Subnets
Instead of creating one massive internet, we create many small internal networks (like mini-internets).
Each internal network can reuse private IP addresses (like 192.168.x.x
, 10.x.x.x
, etc.) behind a router or firewall using NAT (Network Address Translation).
These internal networks are called subnets.
๐งฉ What is a Subnet?
A subnet (sub-network) is a smaller section of a larger network โ like rooms in a house.
By dividing a large network into subnets:
Devices stay organized
Traffic is more efficient
IP addresses are reused smartly
๐ก In DevOps & Cloud:
Youโll often create subnets in AWS VPCs
Youโll assign private IPs and control traffic between them
๐ข IP Address Breakdown โ Subnet Example
Letโs say:
IP: 192.168.10.5
Subnet Mask: 255.255.255.0
Network part: 192.168.10
Host part: .5 (device number in network)
This means:
All devices in
192.168.10.X
belong to the same subnetThe
.5
is the unique address within that subnet
โ Final Summary
Term | Meaning |
IP Address | Unique number to identify a device on a network |
IPv4 | Older version, 32-bit, ~4.2 billion addresses (e.g., 192.168.1.1 ) |
IPv6 | Newer version, 128-bit, 340 undecillion addresses |
Subnet | A logical division of a large network |
NAT | Allows many private IPs to use one public IP for internet access |
Private IPs | Used inside local networks (not directly reachable from internet) |
๐จโ๐ป As a DevOps Engineer, Youโll Use:
Private/Public IPs when deploying servers
Subnets when setting up cloud networks (like AWS VPC)
CIDR notation for subnetting (e.g.,
10.0.0.0/24
)ping
,ip addr
,ifconfig
,ipcalc
, etc. to manage networks
โ๏ธ AWS Networking Essentials: VPC, Subnets, Security Groups, NAT & DNS
๐ง What is a VPC?
VPC (Virtual Private Cloud) is like your own private network inside AWS.
Imagine AWS as a huge city ๐๏ธ, and you get your own private colony inside it. Thatโs a VPC.
๐ Key Points:
You control IP ranges, subnets, routing, and firewall rules.
VPCs are isolated, so IPs wonโt clash between users.
Each EC2 instance you launch lives inside a subnet โ inside a VPC.
๐งฉ VPC Structure Breakdown
Copy
Edit
๐ AWS Cloud
โโโ VPC (Your Private Network)
โโโ Subnets (Smaller segmented networks: Public & Private)
โโโ EC2 Instances (Virtual Machines)
โก๏ธ You can have multiple subnets within a VPC โ think of them as rooms in your house.
๐ IP Addressing Inside VPC
Every device (EC2 instance) inside a VPC gets a unique private IP.
If you enable auto-assign public IP, it gets a public IP too.
IPs donโt conflict because each VPC has its own CIDR range.
๐ฅ What is a Security Group (SG)?
- A Security Group is like a firewall for your EC2 instance.
๐ It controls:
Who can connect to your server
What type of traffic is allowed (HTTP, SSH, etc.)
๐ก SG is stateful โ if you allow incoming traffic on a port, the response is automatically allowed out.
๐ Example: Allow Only Your PC to SSH
Letโs say you want only your personal computer to connect to the EC2 instance via SSH:
Go to your SG in AWS.
Edit inbound rules:
Type: SSH
Port: 22
Source: Your IP Address/32 (get it from whatismyip.com)
โ Now, only your IP can access the EC2 server via SSH.
๐ฅ๏ธ Connecting to EC2 Using Public IP
Once the instance is launched:
Use AWS EC2 Connect (browser) or
Use terminal + .pem key and public IP
ssh -i mykey.pem ubuntu@<public-ip>
๐ Live Webpage Hosting on EC2 (Ubuntu)
Now letโs make your server public by installing a web server:
sudo apt update
sudo apt install nginx
cd /var/www/html
sudo vim index.html
# ๐ Add HTML:
<h1>Hello, I am Prashant Gohel</h1>
Then save file (Esc + :wq)
# Check server:
sudo systemctl status nginx
โ Canโt Access Page? Firewall (SG) is Blocking
By default, port 80 is blocked.
โ Fix: Add HTTP rule in Security Group
Type: HTTP
Port: 80
Source: Anywhere (
0.0.0.0/0
)
Now, open:
http://<your-ec2-public-ip>
# ๐ Your webpage is live!
๐ What is NAT?
NAT (Network Address Translation) allows instances in a private subnet to access the internet securely.
๐ก Use Case:
You want backend servers to update software (apt, yum, etc.) but not be publicly accessible.
NAT Gateway allows outbound internet access without exposing them to the public.
๐ DNS: Domain Instead of IP
Right now, your site is only accessible via IP โ but you want something like:
Steps:
Buy a domain (e.g., from GoDaddy)
Point the domain to your EC2 public IP via DNS settings
Go to GoDaddy DNS manager
Add an A record:
Host: @
Type: A
Points to: <your-ec2-public-ip>
TTL: Default
โ Now, your website can be accessed using your domain!
๐ง OSI Model Behind the Scenes (Quick Review)
OSI Layer | Your Activity |
Application | Open browser โ EC2 Connect or Website |
Presentation | AWS encrypts data for security (HTTPS) |
Session | Your browser session to EC2 remains active |
Transport | Data sent via TCP (port 22 for SSH, 80 for HTTP) |
Network | IP routing (public/private IP) |
Data Link | Ethernet/WiFi to router |
Physical | Fiber cables, routers, network cards |
โ Summary
Concept | Real-World Meaning |
VPC | Your private AWS network |
Subnet | Small segment of a VPC |
Security Group | Firewall that controls traffic to/from EC2 |
NAT | Allows private instances to access the internet |
DNS | Maps a domain to your EC2 public IP |
โ๏ธ AWS VPC Networking โ Subnets, NAT, Gateways, and Route Tables
๐ First, Some Handy CLI Commands
Before we dive into AWS concepts, here are two network diagnostic tools:
1๏ธโฃ Find IP Address of a Website:
nslookup google.com
# โ
This queries DNS and gives you the IP address of the domain.
2๏ธโฃ Trace Route to a Website:
traceroute google.com # Linux/macOS
tracert google.com # On Windows
# โ
Shows the path (hops) your data takes to reach the website โ useful to debug latency or blockages.
๐ What is a VPC (Virtual Private Cloud)?
A VPC is your own private, isolated network inside AWS.
Imagine AWS as a massive city, and your VPC is your private gated colony.
Inside this colony, you can build homes (EC2), roads (subnets), guards (firewalls), and rules (route tables).
Structure:
AWS Cloud
โโโ VPC
โโโ Public Subnet (App Server)
โโโ Private Subnet (DB Server)
Public Subnet
: Accessible from the internet (e.g., EC2 with web app)
Private Subnet
: Not accessible directly from internet (e.g., RDS DB)
๐ก๏ธ Where to Keep Your Database?
Always place your Database (like Amazon RDS) in the private subnet.
Why?
You don't want end users (or hackers) to directly touch your database.
Only the application (in the public subnet) should access the database internally.
๐ How App (Public Subnet) Talks to DB (Private Subnet)?
Hereโs the challenge:
Both subnets are isolated from each other.
IPs in one subnet donโt directly talk to another unless routes exist.
โ Solution: Use NAT Gateway
NAT (Network Address Translation) allows:
Instances in private subnet to access the internet
OR talk to resources in public subnet via IP translation.
So:
App (public) โ NAT โ DB (private) โ Allowed
User โ App works because app is public
User โ DB โ Blocked (secure by design)
๐ But... How Does a User Access My App?
You said it right โ the user is outside AWS, so how can they reach your app which is inside a VPC?
- That's where the Internet Gateway (IGW) comes in.
๐ Internet Gateway (IGW):
Acts like the main gate to your VPC colony.
Without IGW, your VPC is cut off from the internet.
โ Flow:
User (Browser)
โ
Internet Gateway
โ
VPC โ Public Subnet โ EC2 (App)
๐งญ What is a Route Table in VPC?
A Route Table is like a GPS system for AWS networks.
It tells AWS where to send traffic based on destination IP.
Example:
In a route table:
0.0.0.0/0
โ Internet Gateway (for public access)10.0.1.0/24
โ Private Subnet (internal routing)0.0.0.0/0
โ NAT Gateway (for private instances to access internet)Each subnet must be associated with a route table.
๐ Full Traffic Flow: End-to-End Example
Hereโs a complete traffic journey from a user to your EC2 app and how your EC2 talks to RDS:
User
โ
Internet Gateway (IGW)
โ
VPC
โโโ Public Subnet
โโโ EC2 Instance (Web App)
โโโ Talks to RDS (Private Subnet) via NAT Gateway
๐ถ Bonus: VPC Peering
What if you have two separate VPCs (maybe in different regions/accounts) and want them to talk?
- Use VPC Peering โ like creating a private tunnel between two VPCs.
๐ก You need to:
Create peering connection
Accept it
Update route tables on both sides
Ensure security groups allow traffic
โ Summary Table
Concept | Role |
VPC | Isolated network in AWS |
Subnet | Smaller section of a VPC (public/private) |
Public Subnet | Allows internet access |
Private Subnet | Internal-only, secure (e.g., DB) |
NAT Gateway | Allows private subnet to access public subnet/internet |
Internet Gateway | Lets external users access public subnet |
Route Table | Routes traffic inside/outside the VPC |
VPC Peering | Connects two VPCs privately |
โ๏ธ What is a Load Balancer? โ With AWS Perspective
๐ฆ Basic Idea:
A Load Balancer acts like a traffic cop that:
Sits in front of your servers
Distributes incoming traffic across multiple instances
Ensures no single instance is overloaded
Automatically redirects traffic if one server fails
๐ฏ Why is it useful?
High Availability
Auto-Scaling support
Fault Tolerance
Smooth user experience even during heavy traffic
๐๏ธ Types of Load Balancers in AWS
You can find these in:
AWS Console โ EC2 โ Load Balancers
1๏ธโฃ Application Load Balancer (ALB)
Works at Layer 7 (Application Layer) of the OSI model
โ Use when:
You have web applications (HTTP/HTTPS)
You need to route based on URL paths (e.g.,
/api
,/login
)You want host-based routing (e.g.,
admin.example.com
,user.example.com
)
๐ง Smart features:
Supports SSL/TLS termination
Can route based on cookies, user-agent, etc.
Example:
Request โ
https://myapp.com/api
โ goes to API serverRequest โ
https://myapp.com/ui
โ goes to Frontend server
2๏ธโฃ Network Load Balancer (NLB)
Works at Layer 4 (Transport Layer)
โ Use when:
You need ultra-high performance
You're handling millions of TCP/UDP connections
For real-time gaming, high-frequency trading, IoT
Key Traits:
Faster, handles low latency
Routes traffic based on IP and port only
Supports static IP or Elastic IP
Real Example:
During Flipkart Big Billion Days or Amazon Prime Sale, millions of users connect.
A Network Load Balancer helps distribute massive TCP/UDP loads across backend servers.
3๏ธโฃ Gateway Load Balancer (GWLB)
Works with third-party virtual appliances (firewalls, monitoring tools)
โ Use when:
You want to insert security tools (like Palo Alto, Fortinet) into traffic flow
For inspection, filtering, or monitoring traffic
๐ How Load Balancers Fit in AWS Architecture
Internet
โ
Application Load Balancer (ALB)
โ โ
EC2-1 EC2-2
โ โ
Private Subnet (RDS)
The ALB handles web traffic
Distributes to multiple EC2 instances
These may connect internally to a DB in private subnet
๐ก You define Target Groups in AWS to decide which EC2s your Load Balancer can send traffic to.
๐ Layer Comparison: ALB vs NLB
Feature | ALB (App LB) | NLB (Network LB) |
OSI Layer | Layer 7 (Application) | Layer 4 (Transport) |
Protocols | HTTP, HTTPS | TCP, UDP |
Smart Routing | Yes (URL, headers, cookies) | No (IP-based only) |
Use Case | Web apps, microservices | High-speed, high-volume apps |
Latency | Slightly higher | Ultra-low latency |
SSL Termination | Supported | Needs extra setup |
Static IP support | No | Yes |
โ Real-World DevOps Relevance
ALB is common in microservices & containerized apps
NLB is used in enterprise or real-time data systems
Youโll use LB with:
Auto Scaling Groups
ECS / EKS (containers)
RDS or backend APIs
๐ ๏ธ Quick Setup Steps (ALB):
Go to EC2 โ Load Balancers โ Create ALB
Select internet-facing
Choose HTTP / HTTPS
Create Target Group (EC2 or IP based)
Register your EC2 instances
Add Listeners & Rules (e.g., route
/api
tobackend1
)Launch and test via ALB DNS name
Subscribe to my newsletter
Read articles from Prashant Gohel directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Prashant Gohel
Prashant Gohel
DevOps & Cloud Enthusiast | Exploring Linux, AWS, CI/CD & Automation | Sharing hands-on notes, tips, and real-world learning as I grow into a DevOps Engineer