Home / Articles

How Lambda Web Functions host Node HTTP servers

Lambda Web Functions run an existing Express or Next.js server, bill active CPU instead of idle waits, and share up to 128 requests in one environment.

Publisher: REACTAPP.TOP7 min read1549 words

This article is published in English.

Sources: AWS Lambda Web Functions: Run Your Express or Next.js App on Lambda Without Rewriting a Line

Lambda and a normal web framework have been a bad fit for a long time. The runtime wanted a function: event in, result out. Express and Next.js want to open a socket and speak HTTP. Closing that gap meant turning each route into a handler, or parking an adapter between the framework and the event payload. After that you lived with cold starts, a single in-flight request on each environment, and a meter that kept running while the process sat on a database round trip.

The announcement on October 12, 2026 is a direct answer to that mismatch. AWS Lambda Web Functions take the HTTP server you already run and host it. Routes stay routes.

Pricing follows active CPU rather than time spent blocked, and a live cutover still depends on how the process stores data that belongs to one request.

Three shapes on the same Firecracker base

The launch divides Lambda into three products. Firecracker is still the isolation layer under all of them.

  • Event Functions are the Lambda you have used for years, with a new label. An event comes in, your code handles it, and a response goes back. Each environment takes one request, and the bill is wall-clock duration. Queues, file jobs, and triggers from other AWS services still belong here.
  • Web Functions are the new product. The process binds a port and answers ordinary HTTP. Many requests share one environment, and the CPU charge tracks processor time that is actually busy. Web apps, APIs, and pages rendered on the server are the workload it is built for.
  • MicroVMs are sandboxes that keep state and stay isolated. Use them when the code is untrusted, including code a user submitted.

One system can mix the three. Serve the public API from Web Functions, push background jobs to Event Functions, and run customer-supplied code inside MicroVMs.

The two shifts that change the bill

1. More than one request in a single environment. Older Lambda allows one in-flight call per execution environment. A spike means more environments, and each new one can cold-start. A Web Function environment accepts up to 128 requests together. A short burst lands on environments that are already warm, instead of lining up behind fresh ones.

2. Idle time barely shows up on the bill. What you pay is the processor time the code really uses. A database query, a call out to another API, or a slow model burns almost no CPU, so that wait is cheap. Memory is billed differently: it accrues for the whole life of the environment.

Typical web traffic spends most of its time blocked on I/O, so the new meter can come out much cheaper. An AI app that emits tokens one after another is a strong match, because almost the whole request is spent waiting.

Keep the server you already have

The launch sample is an ordinary Express app. It imports the framework, builds the app, splits AWS_LAMBDA_HTTP_ENDPOINT on a colon into host and port, answers GET / with a small JSON body, and calls listen on that host and port.

import express from 'express';
const app = express();
const [host, port] = process.env.AWS_LAMBDA_HTTP_ENDPOINT.split(':');
app.get('/', (req, res) => {
  res.json({ message: 'Hello from Lambda Web Functions!' });
});
app.listen(port, host, () => {
  console.log(`Server running on port ${port}`);
});

That environment variable is the only platform-specific input. Lambda sets it to the address your server must bind. On your laptop, export the same variable and start Node:

AWS_LAMBDA_HTTP_ENDPOINT=127.0.0.1:3000 node index.js

Ship with a single command

Point aws lambda-web deploy at the app directory. It packs that folder, stands up a Web Function, cuts a revision, binds an HTTPS URL, and prints the address. In the sample the function is named my-web-app and the folder is ./my-app.

aws lambda-web deploy --name my-web-app --code ./my-app

AWS quotes a first deploy at under a minute. Edit the code and run the command again, and the next revision is out in seconds.

Several regions from one flag. To cut latency for callers spread around the world, pass the regions on the same deploy:

aws lambda-web deploy --name my-web-app --code ./my-app \
    --regions us-east-1,eu-west-1,ap-northeast-1

The sample lists us-east-1, eu-west-1, and ap-northeast-1. Lambda copies the code into each of those regions and puts latency-based routing in front of one global URL. Wiring that up on your own usually means more than one AWS service.

Canaries are built in. Each deploy writes an immutable revision. An endpoint can send traffic to one revision or split it across several. To hold most callers on the revision already live and try the new one on a slice, disable automatic deployment and set weights:

aws lambda-web update-web-function-endpoint \
    --function-name my-web-app \
    --endpoint-name dev \
    --auto-deployment-mode Disabled \
    --revision-weights '[{"revisionId": "<current-revision-id>", "weight": 90}, {"revisionId": "<new-revision-id>", "weight": 10}]'

The call targets function my-web-app and endpoint dev, with --auto-deployment-mode Disabled. The weights are 90 on the current revision id and 10 on the new one. You get a canary without a separate release tool.

CloudFront for mixed sites

If the app serves both cached files and live responses, place Amazon CloudFront ahead of it. The CDN returns assets it already holds. Live calls are forwarded on to your function.

Origin access control can sit on the endpoint too, limiting callers to that distribution alone. S3 already uses this private-origin idea, and the setup here matches it. Someone who learns the function URL still cannot hit it directly.

Concurrency changes what is safe to store

Announcement summaries usually skip this. When many requests share one environment, a variable declared at module scope is visible to all of them.

Logic that was safe while each environment handled a single request can now mix one caller's data into another caller's request. The sample shows both the leak and the fix:

// Unsafe on Web Functions: shared by all concurrent requests
let currentUser = null;
app.use((req, res, next) => {
  currentUser = req.headers['x-user-id'];  // another request can overwrite this
  next();
});
// Safe: keep request data on the request itself
app.use((req, res, next) => {
  req.userId = req.headers['x-user-id'];
  next();
});

The unsafe middleware writes x-user-id into currentUser, a let at the top of the module. A second request on that process can replace the value before the first request reads it. The safe middleware copies the header onto req.userId, so the id stays on that request object.

Two consequences follow from the shared process:

  • Stay off the CPU while a request is still in flight. The Node.js process has one event loop, so image work or a large JSON reshape blocks every other call sharing that environment. Move the job onto an Event Function, or drop it onto a queue.
  • A pool or a cache created when the process starts is now a plus. Every in-flight call can reuse that database pool or that cache. That sharing helps, provided the objects never keep data for a single caller.

Limits at launch

  • At launch the runtime is Node.js 24, and only the Arm64 build. Python, Java, PHP, and every other language are still missing.
  • Five regions are open: US East in N. Virginia and Ohio, US West in Oregon, Asia Pacific in Tokyo, and Europe in Ireland. A team with users in India should time calls from Tokyo, or wait until more regions show up.
  • VPC networking is available, so the function can open connections to databases and to other resources on a private network.

When a move pays off

A good fit:

  • APIs written for Node.js, including a backend-for-frontend, when the load comes in bursts.
  • Next.js, or another stack that renders on the server, when most of the request is blocked on data.
  • AI chat routes and streaming endpoints that sit idle until the model answers.
  • Anything you already run on Lambda behind an adapter.

Pause on these:

  • Services that burn CPU the whole time. The cost gap gets smaller once the processor is busy.
  • Apps that stash per-request data in module scope. Fix that before you deploy.
  • Steady, high volume traffic. A reserved container fleet, or plain EC2, can still come out cheaper.

Try one API before you cut over

Pick a small Node.js API. It can be something on containers today, or a classic Lambda function that still sits behind an adapter. Search for module-scope variables that hold data from a single request. Ship it by running aws lambda-web deploy, then set latency and spend side by side for seven days of live calls. Shift callers with the built-in canary weights instead of moving everyone at once. If that week looks better, you have a simpler way to host web apps on AWS.