AWS Cloud Security Roadmap, Phase 0 / Ch.1: How a Web Request Travels (DNS, TCP, TLS, HTTP, CIDR)
This is Chapter 1 of a full series. The complete roadmap (networking → Linux → AWS → DevOps → DevSecOps → Cloud Security Engineering → Architecture) lives here: 👉 AWS Cloud Security Roadmap: The Full Learning Path from Networking to Security Engineering Roadmap on Medium, hands-on chapters here on dev.to. Follow the series so you don't miss the next one.
Why start here? Cloud security sits on top of networking. If you can't explain what happens between typing a URL and seeing a page, you can't debug a security group, read a VPC Flow Log, or understand why a TLS certificate matters.
Goal of this chapter: you can trace one request end to end, calculate a CIDR block by hand, and diagnose DNS, port and certificate problems from the command line.
The big picture
Every layer can fail on its own, with its own symptoms. That's the whole skill: know which layer is broken.
1. DNS: names to IPs
Resolution chain: stub resolver (your OS) → recursive resolver (ISP / 1.1.1.1 / 8.8.8.8) → root servers → TLD servers (.com) → authoritative server for the domain.
| Record | Purpose | Example |
|---|---|---|
| A | name → IPv4 | example.com → 93.184.216.34 |
| AAAA | name → IPv6 | example.com → 2606:2800:... |
| CNAME | alias to another name | www → example.com |
| TXT | free text (SPF, domain verification) | "v=spf1 ..." |
| MX | mail servers | 10 mail.example.com |
TTL = how many seconds resolvers may cache the answer. Low TTL = fast changes, more queries. High TTL = fewer queries, slow propagation. This is why "I changed the DNS but nothing happened" is usually just cache.
Rule: a CNAME can't coexist with other records at the same name, and it can't sit at the zone apex. That's why Route 53 has alias records.
2. TCP: reliable delivery
- Three-way handshake: SYN → SYN/ACK → ACK. Only then does data flow.
- A port identifies the service: 22 SSH, 80 HTTP, 443 HTTPS, 53 DNS, 3306 MySQL, 5432 PostgreSQL.
- TCP vs UDP: TCP = ordered, acknowledged, retransmitted. UDP = fire and forget (DNS queries, streaming, QUIC builds on it).
- Symptoms to recognize:
- Connection refused → host reachable, nothing listening on that port.
- Timeout → packets dropped silently (firewall / security group / wrong route).
That distinction (refused vs timeout) will save you hours in AWS later.
3. TLS: the encrypted channel
- Client sends ClientHello with SNI (the hostname it wants, so one IP can host many sites).
- Server returns its certificate chain (leaf → intermediate → root CA).
- Client verifies: chain trusted? hostname matches? not expired?
- Both sides derive session keys; everything after is encrypted.
What a certificate proves: whoever answered controls that domain name, as validated by a CA. What it does NOT prove: that the site is honest or safe. Phishing sites have valid certificates too.
4. HTTP: the conversation
| Code | Meaning | Think |
|---|---|---|
| 200 | OK | worked |
| 301 / 302 | redirect | follow Location header |
| 400 | bad request | client sent garbage |
| 401 | unauthenticated | who are you? |
| 403 | forbidden | I know you, no access |
| 404 | not found | wrong path |
| 429 | too many requests | rate limited |
| 500 | server error | app crashed |
| 502 / 503 / 504 | bad gateway / unavailable / gateway timeout | typical load balancer symptoms |
Methods: GET read, POST create, PUT replace, PATCH modify, DELETE remove.
Headers worth knowing: Host, Cookie, Set-Cookie, Authorization, Content-Type, Location, Strict-Transport-Security.
5. IPv4 and CIDR: do it by hand
/N means the first N bits are the network part. Addresses in the block = 2^(32−N).
| CIDR | Addresses |
|---|---|
| /16 | 65,536 |
| /24 | 256 |
| /26 | 64 |
| /28 | 16 |
Private ranges (RFC 1918): 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16.
Worked example A: 192.168.10.77/26
- Block size = 64 (since /26 leaves 6 host bits, 2^6 = 64).
- 77 falls in the block starting at 64 → network = 192.168.10.64
- Broadcast = 192.168.10.127 (64 + 64 − 1)
- Usable hosts = .65 - .126 (62 hosts)
Worked example B: 10.0.5.200/22
- /22 → block size 4 in the third octet.
- 5 falls in the block starting at 4 → network = 10.0.4.0
- Broadcast = 10.0.7.255
- Usable hosts = 10.0.4.1 - 10.0.7.254 (1,022 hosts)
☁️ AWS preview: AWS reserves 5 addresses in every subnet, so a /24 subnet gives 251 usable IPs, not 254. We'll use this in the VPC chapter.
Quick drill (answers at the bottom)
- How many addresses in a /20?
- What's the broadcast of 172.16.33.9/21 ?
6. Routing, NAT, stateful vs stateless
- Default gateway: where your host sends anything not on its local network.
- NAT: many private hosts share one public IP; the NAT device rewrites addresses and tracks connections.
- Stateful filter: remembers connections; if outbound is allowed, the reply is automatically allowed. (AWS security groups.)
- Stateless filter: judges every packet alone; you must allow return traffic explicitly. (AWS network ACLs.)
🛠 Build: trace one request
Run these against any site and label each output on your diagram:
dig +trace example.com # full DNS resolution chain
curl -v https://example.com # TCP + TLS + HTTP in one view
openssl s_client -connect example.com:443 -servername example.com # cert chain
ss -tulpn # what's listening on YOUR machine
traceroute example.com # path through routers
Deliverable: redraw the request diagram above from memory (draw.io / Excalidraw / paper) with the real output of each command next to its layer. Drawing it yourself is what makes it stick.
💥 Break it (and diagnose from the CLI)
| Break | How (in a lab / local machine) | How to diagnose |
|---|---|---|
| Wrong DNS | add 127.0.0.1 mysite.test vs a wrong IP in /etc/hosts | dig, getent hosts, curl -v shows the IP used |
| Blocked port 443 | local firewall rule dropping 443 | curl -v hangs (timeout), nc -zv host 443 |
| Nothing listening | stop your local web server | curl → connection refused, ss -tulpn shows no listener |
| Expired / mismatched cert | use curl https://expired.badssl.com or wrong.host.badssl.com (public test sites) |
openssl s_client + curl -v error text |
Write each fix as a 3-line runbook: symptom → check → fix.
✅ Cheat sheet
| Symptom | Likely layer | First command |
|---|---|---|
| "Could not resolve host" | DNS | dig example.com |
| Hangs then times out | Firewall / routing | nc -zv host port, traceroute |
| Connection refused | Nothing listening | ss -tulpn on the server |
| Certificate error | TLS | openssl s_client -connect host:443 -servername host |
| 403 / 404 / 5xx | HTTP / app | curl -v, check app + LB logs |
✔ Checkpoint
You're ready for the next chapter when you can, without notes:
- explain DNS → TCP → TLS → HTTP in order,
- compute network/broadcast/host range for any CIDR,
- tell "refused" from "timeout" and know what each implies,
- diagnose a bad cert from the command line.
Drill answers: 1) 4,096. 2) /21 → block size 8 in the third octet; 33 is in 32-39 → broadcast 172.16.39.255.
📚 Docs
What is DNS? (Amazon Route 53) MDN: HTTP MDN: Transport Layer Security
Next up: Chapter 2, Linux for cloud engineers (users, permissions, systemd, logs, SSH hardening). Full roadmap with every phase, certification path and job mapping: 👉 Read the complete AWS Cloud Security Roadmap on Medium
Lab note: commands tested conceptually against public test domains only. Only test systems you own or are authorized to test.
Comments
No comments yet. Start the discussion.