Where Did My Request Die? I Built an AWS Lab Where You Break the Network on Purpose
Timeout, connection refused, or 403? A free interactive lab with 5 real-world scenarios and 55 breakable layers that shows exactly where AWS drops your request, plus a live mode where real CloudFront, WAF, ALB and EC2 answer back from 09:00 to 19:00 SGT.
curl: (28) Connection timed out after 10001 millisecondscurl: (7) Failed to connect to port 443: Connection refusedAn error occurred (AccessDenied) when calling the GetObject operation ... with an explicit deny in a service control policyThree errors. Three completely different root causes. And one lost afternoon each, clicking through route tables, security groups, NACLs and policies, trying to work out which layer quietly said no.
So I built a lab for exactly that moment.
👉 lab.satyajitlembhe.com
Every scenario starts broken. You send a request, watch the packet travel through every gateway, route table, firewall and policy, and see it stop exactly where AWS would stop it, with the real error, the reason and the fix. Then you flip any layer and try again.
No account. No sign-up. No AWS bill. Just open it and start breaking things.
And between 09:00 and 19:00 SGT, it stops being a simulation: real requests hit real CloudFront, WAF, ALB and EC2. More on that below.
🧪 5 scenarios. 55 layers. Every one of them breakable.
🌐 1. Internet → Web server · open it
The classic "my site won't load" ticket.
- IGW detached or no public IP → silent timeout
- NACL inbound with a
DENYnumbered before theALLOW. Rule order bites.
- NACL outbound that forgets ephemeral ports (1024–65535), the #1 stateless-firewall trap
- Route table sending
0.0.0.0/0to a NAT gateway instead of the IGW
- nginx bound to
127.0.0.1: the network is perfect and you still get connection refused
🔐 2. Cross-account S3 from a private subnet · open it
The one that makes senior engineers sigh. 12 layers across 2 organizations.
- Gateway endpoint vs NAT route (one works but costs per GB and skips your endpoint policy)
- SCP perimeter (
aws:ResourceOrgID) and RCP (aws:PrincipalOrgID)
- Role policy capped by a permissions boundary, plus a VPC endpoint policy
- Bucket policy, Block Public Access,
aws:SourceVpce
- A KMS key policy that forgot you: a 403 after S3 already said yes
🔒 3. HTTP vs HTTPS through CloudFront and ALB · open it
- Viewer protocol policy, origin protocol, and the cert that must live in us-east-1
- ALB SG that doesn't trust CloudFront, listeners missing 443
- Origin domain vs ALB certificate mismatch → the dreaded 502
🚪 4. Private subnet and NAT gateway · open it
- NAT gateway placed in the private subnet (it must live in a public one)
- Missing
0.0.0.0/0 → NATor→ IGWroutes, NACLs that block return traffic
- Why unsolicited inbound through NAT is impossible by design
🏢 5. Multi-account: dev, non-prod, prod · open it
Transit Gateway at enterprise scale. 14 layers.
- TGW attachments shared via RAM, separate TGW route tables so dev can't reach prod
- Overlapping CIDRs, centralized egress VPC, and the return path everyone forgets
🩺 The 10-second diagnosis cheat sheet
The one habit the lab drills: read the symptom before touching anything.
You see | It means | Look at |
|---|---|---|
⏱️ Timed out | Packet silently dropped. Policies never consulted. | SGs, NACLs, routes, missing IGW/NAT/public IP |
🚫 Connection refused | Network worked. Nothing is listening. | Process, bind address, port |
⛔ 403 Access denied | Network worked. A policy said no. | SCP, RCP, identity, boundary, endpoint, resource, KMS |
The evaluation order behind every 403, in five lines:
- An explicit deny anywhere wins. Always.
- SCPs (caller's org) and RCPs (resource's org) must allow. They cap, they never grant.
- Same account: identity or resource policy can allow. Cross-account: both must.
- Permissions boundaries and VPC endpoint policies cap everything else.
- KMS-encrypted data adds one more check: the key policy.
The lab reports the first blocking layer, so fixing one can reveal the next. Exactly like real life.
⚡ Then it stops being a simulation
You shouldn't have to trust that the 403 on screen is real. So from 09:00 to 19:00 Singapore time, Live mode is backed by real AWS infrastructure:
- Send a real request → CloudFront → AWS WAF → ALB → real EC2 in private subnets
- Watch it hop AZs. Each response shows instance ID, AZ and private IP, alternating between
ap-southeast-1aandap-southeast-1b
- Press "Attack". A real SQL injection string, blocked at the edge before it ever touches the ALB:
HTTP/2 403{"blocked_by":"AWS WAF","reason":"SQLi_QUERYARGUMENTS"}- Visit after 7 pm? The backend has been destroyed for the night. The page says so, falls back to simulation in ~2 s, and tells you when it's back in your own time zone.

Solid blue: always on. Dashed amber: exists only 09:00–19:00 SGT.
🛠️ How it's built
All Terraform, split by one rule:
Anything billed by the hour gets destroyed every evening. Everything else stays.
Stack | Lifecycle | Contents |
|---|---|---|
Front door | Always on | S3 + CloudFront (OAC), ACM, Route 53, AWS WAF |
Live base | Always on | VPC across 2 AZs, subnets, S3 gateway endpoint, SGs, launch template, origin secret in SSM |
Live daytime | 09:00–19:00 | ALB, listener rules, target group, ASG (2 × Graviton t4g.micro), origin DNS record |
Scheduler | Always on | Remote state, CodeBuild, EventBridge Scheduler, failure alerts |
Design choices worth stealing:
- 🔒 No NAT gateway, no SSH, no public IPs, IMDSv2 only. ~75 lines of Python stdlib means zero internet egress.
- 🛡️ Origin locked down three ways: ALB SG allows only the CloudFront origin-facing prefix list, a secret header checked by the listener rule, and a default 403 for everything else. WAF can't be bypassed.
- 🎯 WAF responses that name the rule. Each managed rule gets its own custom JSON body, so the 403 tells you which rule fired.
- 😴 Sleeping without breaking. CloudFront origin set to 1 connection attempt, 2 s timeout, so after hours it fails fast instead of hanging for 30 s.
- ♻️ Fresh every morning. Latest AL2023 AMI via
resolve:ssm:, andwait_for_elb_capacityonly goes green when both instances are healthy.
- ⏰ Scheduling: EventBridge Scheduler (
Asia/Singapore) → CodeBuild →terraform applyat 9,destroyat 7, a one-time safety stop on 31 Dec, and S3-native state locking (use_lockfile). No DynamoDB table.
💰 Cost: about $28/month. Running 24/7 would multiply the hourly part by ~2.4.
4 gotchas that cost me a failed apply
- SSM parameter names can't start with
awsorssm, even after the slash:/aws-network-lab/...→AccessDeniedException.
- WAF web ACL descriptions reject
*. And Terraform applies are not transactions: everything before the failure was already applied.
- A properly locked origin doesn't return 403. It times out. The SG drops the packet. The lab's own cheat sheet, proven on my own infra.
- S3-native state locking needs Terraform ≥ 1.10. Check before your CI does.
🎯 Who it's for
- ☁️ Cert candidates: SA, Advanced Networking and Security Specialty questions are exactly these scenarios
- 🧑💻 Engineers new to AWS: break a lab, not production
- 🚨 On-call engineers: build the "timeout vs refused vs 403" reflex
- 👩🏫 Leads and trainers: drop a deep link into onboarding or a post-incident review
🚀 Your 3 challenges
- Web server : find three layers that cause a timeout, and the one that gives "connection refused".
- Cross-account S3 : get a 403 even though the bucket policy allows you. (There are at least five ways.)
- Live mode (09:00–19:00 SGT): send five real requests, count the AZ switches, then hit Attack and read which WAF rule caught you.
Drop a comment: which layer caught you out? And what should I build next: VPC peering, PrivateLink, or Route 53 Resolver?
If this helped, share it with someone who's staring at a timeout right now. 🙂
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article