All posts

A serverless setup that stays cheap

Serverless is only cheap if you build for it. A few habits keep the bill flat while the product grows.

Clients love hearing that they only pay for what they use. That promise holds only if the architecture respects it. Serverless done carelessly can cost more than a plain server.

Keep functions small and stateless

Each function does one job and holds no state between calls. State lives in DynamoDB or S3, never in the runtime. That is what lets the platform scale to zero when nobody is using the app.

Design the data model around the questions

With DynamoDB I model tables around the exact queries the app makes, not around a tidy relational diagram. Fewer round trips means lower latency and a smaller bill.

  • Store files in S3, keep only references in the database
  • Cache what does not change; never recompute a stable value
  • Watch cold starts on the paths users actually hit

Do this and the cost curve stays almost flat while traffic climbs. That is the whole point.

A serverless setup that stays cheap, by Noor A. Ridha