Technical
The Serverless Lesson I Would Write On A Sticky Note
I have shipped enough serverless work in the last year that patterns are clear. There is one rule that would fit on a sticky note and would have saved me most of the pain.
The business problem is cost and reliability. Serverless promises pay-per-use and auto scale. Those promises come with conditions. Ignore the conditions and the bill surprises you.
The rule
If the workload runs for more than five minutes at a time or costs more than one dollar per run, do not use Lambda. Use a container or a small VM.
Why this rule
Lambda and similar functions are optimized for short bursty workloads. Long running work hits timeouts, warm up latency, and surprisingly high per-invocation overhead. The cost per compute hour of a busy Lambda is often worse than a small always-on VM.
The math I actually ran
A client had a daily report generator that ran for eight minutes on Lambda. The monthly bill was $180. Moved it to a t3.small EC2 instance that runs the same script on a cron schedule. Monthly bill: $18.
When serverless actually wins
- Webhook handlers that run for a second at a time
- Low volume APIs where a VM would sit idle 90 percent of the time
- Glue between AWS services where IAM is already set up
When I skip it
- Any job that takes more than a minute
- Anything with heavy cold start penalties (large ML libraries)
- Anything that needs a long lived database connection
The other lesson
DynamoDB single table is great for patterns you know in advance. The day you need ad hoc analytics, a relational database with SQL will save you a month. Plan for both. See the AWS Lambda pricing page and run the math before you commit. I should have a year ago.
RELATED READING
The Consulting Shift I Am Making In Year Two
After a year of writing and building, my consulting practice is changing shape. Shorter engagements. Sharper outcomes.
ReadThe Frontend Shift: Shipping Less JavaScript In Year Two
A year ago I reached for Next.js for everything. This year I often reach for nothing.
ReadA Year Two Python Refactor: What I Changed In My Script Style
My Python style shifted over the year. Four small changes that made every script shorter and easier to read.
Read