TL;DR: Here's the math that pushed me off EC2: a t3. micro instance runs you roughly $8-10/month whether it serves zero requests or ten thousand.
📖 Reading time: ~30 min
What's in this article
The Problem: Your Flask App Works Locally, Now What?
How Lambda Actually Runs Your Flask App (Understand This First)
Prerequisites and Local Setup
Step 1 — Build a Minimal Flask App Worth Deploying
Step 2 — Package Dependencies Correctly (Where Most Tutorials Fail)
Step 3 — Write the SAM Template (template.yaml)
Step 4 — Deploy and Test
Gotchas I Hit That Aren't in the AWS Docs
The Problem: Your Flask App Works Locally, Now What?
Here's the math that pushed me off EC2: a t3.micro instance runs you roughly $8-10/month whether it serves zero requests or ten thousand. Lambda charges $0.20 per million invocations plus compute time billed in 1ms increments.…