Aug 2026 · Serverless / AWS

How I Built and Maintain ~1,000 AWS Lambda Functions

Since 2023 I've built and maintained close to 1,000 REST API endpoints on AWS Lambda in Node.js — mostly one function per route, deployed through the Serverless Framework and routed through API Gateway. Nobody sets out to build a thousand Lambda functions on day one; it happens gradually as an API grows, and the practices that work fine at 20 functions start breaking down well before you hit 500. These are the patterns that actually held up.

One function per endpoint, not one giant handler

The alternative to many small functions is a single "monolith Lambda" behind API Gateway that internally routes requests (often via serverless-http wrapping an Express app). That's a reasonable starting point, but at scale it stops making sense: every deploy ships every route at once, a bug in one handler can blow the memory/timeout budget for unrelated routes, and cold start cost scales with the size of the bundle every request has to load — even for a route that touches none of that code.

One function per endpoint means each route has its own memory setting, its own timeout, its own IAM permissions (least privilege actually enforced, not just aspirational), and — critically — its own deploy. Shipping a fix to one endpoint doesn't require redeploying the other 999.

A project structure that doesn't collapse under its own weight

The single biggest mistake at this scale is one flat functions: block in a monolithic serverless.yml. It works until it doesn't — CloudFormation stacks have hard resource limits, and a single stack with a thousand Lambda functions plus their IAM roles, log groups, and API Gateway resources will eventually hit them.

What works: splitting by domain into separate Serverless Framework services (auth, billing, notifications, etc.), each with its own stack, its own serverless.yml, and its own CI pipeline — stitched together under one API Gateway custom domain via base path mappings. A change to the billing service redeploys the billing stack. Nothing else moves.

Shared code goes in a Lambda Layer, not copy-pasted

Auth helpers, DB connection logic, logging wrappers, response formatters — the code every handler needs — lives in a shared Lambda Layer rather than being duplicated (or worse, drifting) across a thousand individual function bundles. It also keeps each function's own deployment package small, which matters directly for cold start time.

Cold starts are a bundling problem before they're an AWS problem

The biggest lever on cold start latency isn't provisioned concurrency — it's keeping each function's actual bundle small. A few habits that mattered more than any AWS setting:

Shared infra: Cognito, S3, EventBridge

Auth is centralized through a single AWS Cognito user pool shared across every service, with a Lambda authorizer validating JWTs at the API Gateway layer rather than in every individual handler. File uploads route through S3 with pre-signed URLs so the Lambda itself never proxies file bytes through its own execution time. Scheduled and recurring jobs run through EventBridge rules invoking dedicated Lambda targets, kept separate from the request/response API functions entirely.

Observability at a thousand-function scale

With one CloudWatch log group per function by default, "search everything" isn't realistic through the console alone. What actually helps:

Migrating in from an always-on server

A meaningful share of these endpoints started life on an always-on Express server and moved over incrementally — one route, or one logical group of routes, at a time behind the same API Gateway domain, rather than a big-bang rewrite. That kept the always-on server and the serverless endpoints running side by side during the transition, with traffic cut over route by route once each one was verified in production.

The pattern that scales isn't a clever trick — it's treating each function as a small, independently deployable unit from the start, instead of retrofitting that discipline in after the fact.

Migrating or scaling a serverless backend?

This is the kind of work I do for clients moving off always-on servers or scaling an existing AWS Lambda setup that's started to strain. Get in touch, or see how I handle an Express to AWS Lambda migration and AWS Lambda development.