Awalim Groupعوالِم قروب

Cloud architecture3 min read

Serverless on AWS: architecture that scales without limits

When serverless is the right call and when it is a trap — by the cost, the cold start and the ceiling, not by enthusiasm.

By Awalim infrastructure team

«Serverless» is a promise that you pay only for what you use and never manage a machine. The promise is true — with conditions. And when the conditions are broken, either the surprise bill arrives at the end of the month or the response time angers the first user of the morning.

When it is the right call

  • Intermittent load: an API called hundreds of times an hour and then silent all night. Paying per invocation is cheaper than a machine running 24 hours.
  • Event processing: an image is uploaded and processed, a file arrives and is parsed. The function runs for seconds and disappears.
  • A small team with no infrastructure engineer: no machines to patch and no operating system to update.

When it is a trap

Three cases we have seen repeat:

  • Cold start: a rarely called function needs a second or more to wake. For an interface a human is waiting on, that is unacceptable. The fix is either paid warming (provisioned concurrency) — at which point you have lost half the cost advantage — or a small always-on server.
  • Database connections: every function opens a new connection. At a peak of hundreds of concurrent functions, the database collapses, not the functions. You need a connection proxy (RDS Proxy or equivalent) from day one.
  • High steady load: if your service runs at a constant load all day, a dedicated server is cheaper several times over. The arithmetic is simple: invocations × duration × price, against the monthly price of a server.

The calculation we run before deciding

# rough monthly cost for one function
invocations   = 3_000_000        # invocations/month
avg_ms        = 250              # average duration
memory_gb     = 0.5
gb_seconds    = invocations * (avg_ms/1000) * memory_gb
compute_cost  = gb_seconds * 0.0000166667
request_cost  = invocations * 0.0000002

print(round(compute_cost + request_cost, 2))  # ≈ $6.85
# against a small always-on server ≈ $15–30 — with no cold start and no concurrency ceiling

The numbers are approximate and vary by region and provider, but the idea holds: the decision is taken by arithmetic, not by enthusiasm.

What we usually do

We mix. The main interface a human waits on runs on a small always-on server (or at the Edge, with a near-zero wake time). The heavy intermittent processors — parsing a document, generating a report, sending a batch of email — run on serverless functions. And the database always sits behind a connection proxy.

«Serverless» is not an architecture; it is a billing model. Choose it where it saves, and avoid it where it costs.

In short

Unlimited scale is real — and so is an unlimited bill. What separates them is arithmetic before the decision, a connection proxy before the first deploy, and an alert budget before the first month.

Next step

Have a specific engineering question?

Sometimes one short call saves weeks on the wrong path.

  • We reply within two working days
  • The code is entirely yours
  • Published numbers, signed and verifiable