
Serverless Isn't "No Servers." It's "Not My Servers."
API Gateway, Lambda, DynamoDB, and the mindset shift that actually matters.
The lie in the name
Yes, there are servers. Plenty. You just don't babysit them.
Traditional: you own the servers, the OS, patching, scaling, capacity planning.
Lambda: you own the function code and its config. AWS owns everything underneath.
That's the whole deal. Everything else is consequences.
The smallest useful setup
Client ā API Gateway ā Lambda ā DynamoDB / S3API Gateway takes the HTTPS request, Lambda runs your logic, DynamoDB holds the state. It's also the standard pattern in AWS's own serverless docs, so you're not doing anything exotic.
A Ā
POST /investigationsĀ request looks like this: validate ā run logic ā write to DynamoDB ā return. The caller waits the whole time. Fine for CRUD. Not fine for anything slow.Lambda is not a tiny server
The first mistake everyone makes: stuffing the whole app into one function.
ā One Giant Lambda: auth + users + payments + reports + everything
ā
/users ā User Lambda /payments ā Payment Lambda /reports ā Report Lambda /jobs ā Worker LambdaOne function, one job. If you're building an app server inside a function, you've just rented a worse server.
Sync vs async (the decision that matters most)
Sync: caller waits. Good for quick stuff.
Async: caller gets a Ā
jobIdĀ back immediately, and a worker does the slow thing in the background.Browser ā API Gateway ā API Lambda ā writes job (status=queued) ā returns jobId ā Worker Lambda ā does the long work ā updates DynamoDBI used this shape for an investigation-style workload. The API Lambda never runs the actual investigation. It just queues it and gets out of the way. The client polls the status and moves on with its life.
Events are the real superpower
Lambda gets fun when events become the seams between your components:
S3 upload ā Lambda ā process fileOr Lambda consuming from SQS or DynamoDB Streams. Stop asking "where's my server?" and start asking:
What happened? What needs to run? What state needs saving?
Event ā function ā state ā next event. That's the mental model.
The trade-offs nobody puts on the landing page
- Cold starts: a fresh environment needs a moment to spin up.
- Stateless: never treat the execution environment as storage.
- Time limits: long jobs need an async design.
- Debugging: one request can hop through five services. Good luck without tracing.
- Lock-in: the more managed services you glue together, the more AWS-shaped you get.
Serverless doesn't remove problems. It moves them.
Habits that save you later
Init clients outside the handler so warm invocations reuse them:
python
import boto3
dynamodb = boto3.resource("dynamodb") # created once, reused
def lambda_handler(event, context): table = dynamodb.Table("Investigations") ...Make everything idempotent. Events can be delivered twice. Your system shouldn't care.
Watch for recursive loops. S3 ā Lambda ā S3 ā Lambda ā your bill. AWS warns about this for a reason.
Log structured JSON, not vibes.
json
{ "requestId": "abc-123", "function": "investigationWorker", "stage": "verifyingEvidence", "durationMs": 842, "status": "failed"}Ā
ERROR something failedĀ tells you nothing. This tells you which invocation, which stage, how long, and whether it's a one-off or systemic.Least privilege, per function. API Lambda gets DynamoDB read/write. Worker gets S3 and Bedrock. Nobody gets Ā
AdministratorAccessĀ because "it's easier for now." Each function is its own security boundary, so treat it like one.About the bill
Pay-per-execution is great for spiky or unpredictable traffic. But chatty functions, pointless invocations, and heavy data transfer will still burn money. Serverless is cheap when the design is good, not automatically.
Takeaway
Serverless isn't about deleting servers from the diagram. It's about moving the boundary from managing infrastructure to events, functions, and explicit state.
Don't lift your old server architecture into Lambda. Design for serverless from day one.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article