Developers building web applications on AWS Lambda have traditionally needed to adapt their HTTP applications to Lambda's event-driven execution model. Frameworks such as Express.js already know how to handle HTTP requests, but a conventional Lambda function expects an event, processes it, and returns a response.
The AWS Lambda Web Adapter helped bridge this gap by translating Lambda events into HTTP requests. However, developers who want to run a standard web server can now consider another option: AWS Lambda Web Functions.
Introduced in October 2026, Lambda Web Functions allow developers to run supported Node.js web applications directly on Lambda without an additional HTTP adapter. The application listens on a port, handles requests through its existing framework, and receives a managed HTTPS endpoint.
This approach is useful for REST APIs, server-rendered applications, and other HTTP workloads. Let's look at how it works and how to build a simple application.
Understanding AWS Lambda Web Functions
Traditional Lambda functions follow an event-driven programming model. AWS invokes a handler, passes it an event and context, and waits for the handler to return or complete its execution.
A conventional web server works differently. It starts listening on a port and handles incoming HTTP requests through a framework's routing and middleware.
Lambda Web Functions support this HTTP-native model. Instead of converting incoming requests into application-specific Lambda events, the application runs as a standard Node.js HTTP server.
AWS manages the execution environment and HTTPS endpoint, while the application handles requests using its normal web framework. At launch, the managed Web Functions runtime supports Node.js 24.
How the Request Flow Works
The architecture is straightforward:
Browser or API Client
|
| HTTPS Request
v
Lambda Web Function Endpoint
|
| HTTP Request
v
Node.js Web Server
|
v
Express Route or Middleware
|
v
HTTP Response
The endpoint terminates HTTPS and forwards the request to the application inside the Lambda execution environment.
Your application does not need to manage the endpoint's TLS certificates. Instead, it listens on the host and port provided through the AWS_LAMBDA_HTTP_ENDPOINT environment variable.
Build a Simple Express Application
Let's create a small Express application that returns JSON responses.
Step 1: Create the Project
Create a project directory and initialize npm:
mkdir lambda-web-app
cd lambda-web-app
npm init -y
npm install express
Install Express as a production dependency. The application will use it to define routes and handle HTTP requests.
Update package.json to enable ES modules:
{
"name": "lambda-web-app",
"version": "1.0.0",
"type": "module",
"scripts": {
"start": "node index.js"
},
"dependencies": {
"express": "^5.0.0"
}
}
The dependency version shown is an example. Use a version compatible with your project, and retain the lockfile generated during installation so deployments use a reproducible dependency tree.
Step 2: Write the HTTP Server
Create an index.js file:
import express from "express";
const app = express();
app.use(express.json());
app.get("/", (req, res) => {
res.json({
message: "Hello from AWS Lambda Web Functions"
});
});
app.get("/health", (req, res) => {
res.status(200).json({
status: "healthy"
});
});
app.post("/orders", (req, res) => {
const { productId, quantity } = req.body ?? {};
if (
typeof productId !== "string" ||
productId.trim() === "" ||
!Number.isInteger(quantity) ||
quantity <= 0
) {
return res.status(400).json({
error: "A valid productId and quantity are required."
});
}
res.status(201).json({
message: "Order request received",
productId,
quantity
});
});
const endpoint =
process.env.AWS_LAMBDA_HTTP_ENDPOINT ??
"127.0.0.1:3000";
const [host, portText] = endpoint.split(":");
const port = Number(portText);
if (!host || !Number.isInteger(port) || port <= 0) {
throw new Error("Invalid HTTP endpoint configuration.");
}
app.listen(port, host, () => {
console.log(`HTTP server listening on ${host}:${port}`);
});
The most important part is the server startup configuration.
Lambda provides the address through AWS_LAMBDA_HTTP_ENDPOINT. The application reads that value and starts listening on the assigned host and port.
The local fallback allows developers to run the same application on their computers without requiring Lambda-specific configuration.
The /orders endpoint also performs basic input validation. In a real application, you would add authentication, authorization, business rules, and persistent storage before creating orders.
Step 3: Run the Application Locally
Start the server:
npm start
The application should listen on 127.0.0.1:3000 when the Lambda environment variable is not set.
Test the endpoint:
curl http://127.0.0.1:3000/
Expected response:
{
"message": "Hello from AWS Lambda Web Functions"
}
You can also test the validation logic:
curl -X POST http://127.0.0.1:3000/orders \
-H "Content-Type: application/json" \
-d '{"productId":"P100","quantity":2}'
This local testing step helps verify the HTTP routes before deploying the application.
Deploy the Application to AWS Lambda
Lambda Web Functions use a different deployment model from traditional event-handler functions.
You need an AWS account with the required permissions and an up-to-date AWS CLI that supports the Lambda Web Functions commands.
Step 1: Verify the AWS CLI
Check the installed CLI version:
aws --version
Confirm that your CLI supports the lambda-web command:
aws lambda-web help
If the command is unavailable, update the AWS CLI to a version that supports Lambda Web Functions.
You should also configure AWS credentials and the appropriate deployment permissions before continuing.
Step 2: Deploy the Application
From the directory containing index.js and package.json, run:
aws lambda-web deploy \
--name my-web-app \
--code .
The command illustrates the basic deployment flow documented for Lambda Web Functions.
The service creates the web function and its associated endpoint. Consult the deployment output for the endpoint address and any additional setup required by your account or region.
After deployment, send an HTTPS request to the generated endpoint and verify that the application returns the expected response.
For production deployments, use the supported deployment configuration to define runtime settings, execution limits, networking, and access controls explicitly.
Lambda Web Functions vs. Traditional Lambda Functions
Choosing the right Lambda model depends on how your application processes requests.
Feature | Lambda Web Functions | Traditional Lambda Event Functions |
|---|
Programming model | Standard HTTP server | Event handler |
Request handling | Framework routes HTTP requests | Handler processes the incoming event |
Web framework integration | Direct for supported Node.js frameworks | Usually requires event-to-HTTP adaptation for conventional servers |
Concurrency | Multiple concurrent requests per execution environment | Traditional handler execution model processes one invocation at a time per environment |
Common use cases | Web applications and HTTP APIs | Queue consumers, event processing, and service-triggered tasks |
HTTPS endpoint | Managed Web Function endpoint | Function URL or API Gateway can provide HTTP access |
Runtime support | Node.js 24 at launch | Multiple supported runtimes, depending on Lambda's runtime offerings |
The two models solve different problems. Web Functions suit applications that naturally operate as HTTP servers, while Event Functions remain appropriate for event-driven processing.
Production Considerations
Handle Concurrent Requests Safely
Lambda Web Functions can handle multiple concurrent requests within one execution environment. This makes asynchronous I/O important.
Avoid storing request-specific information in global variables. Multiple requests share the same application process, so shared mutable state can cause data to leak between requests.
Use request-scoped variables and middleware context for information associated with a particular user or request.
Avoid Blocking the Event Loop
Long-running synchronous operations can block other requests handled by the same Node.js event loop.
Use asynchronous database operations and file access where appropriate. For CPU-intensive work, consider worker threads or a separate compute service.
Configure Timeouts
Database calls and external API requests should have explicit timeouts. A slow dependency can otherwise occupy request processing for too long.
Set the Web Function's request timeout according to the application's requirements, and return meaningful error responses when dependencies fail.
Protect the Endpoint
A managed HTTPS endpoint does not automatically provide application-level authorization.
Configure the endpoint's supported authentication options and enforce application permissions where required. Do not expose administrative routes or sensitive data without appropriate access controls.
Monitor Logs and Errors
Use structured logging and record enough information to investigate failed requests without exposing credentials or personal information.
Lambda adds a lambda-web-request-id header to forwarded requests and responses, which can help correlate client requests with application logs.
Common Mistakes to Avoid
One common mistake is hard-coding the server port. Lambda expects the application to listen on the address supplied through AWS_LAMBDA_HTTP_ENDPOINT. If the server listens elsewhere, incoming requests will not reach it.
Another mistake is assuming that every existing web framework works without configuration changes. Most supported Node.js frameworks can start an HTTP server directly, but frameworks with their own server startup conventions may need a small entry file to configure the correct host and port.
Developers should also avoid relying on in-memory application state for persistent business data. An execution environment may be replaced, and multiple environments may serve requests concurrently.
Finally, do not assume that local success proves the deployed application is correctly configured. Test the actual endpoint, authentication settings, database connectivity, and error handling after deployment.
Advantages and Disadvantages
Advantages
Runs standard Node.js HTTP applications without an event-to-HTTP adapter.
Allows developers to retain familiar web frameworks and routing patterns.
Provides a managed HTTPS endpoint.
Supports multiple concurrent requests within an execution environment.
Reduces the need to configure separate web-serving infrastructure.
Disadvantages
Runtime and framework support must match the available Web Functions capabilities.
Shared process state requires careful handling.
CPU-intensive work can affect concurrent requests.
Applications still need secure configuration, monitoring, and dependency management.
Workloads requiring infrastructure or runtime features outside the supported model may need another deployment approach.
Summary
AWS Lambda Web Functions provide a way to run standard Node.js HTTP applications on Lambda without adding an event-to-HTTP adapter. Developers can use familiar frameworks such as Express, define ordinary HTTP routes, and deploy the application with the supported Lambda Web Functions tooling.
The key requirement is to start the server using the host and port provided by AWS_LAMBDA_HTTP_ENDPOINT. After that, the application can handle requests through its normal routing and middleware.
For production use, pay attention to concurrency, asynchronous operations, request timeouts, authentication, and logging. Lambda Web Functions are a useful option for HTTP-native workloads, while traditional Lambda Event Functions remain a good fit for event-driven processing.
Join the conversation! Your thoughts help the community grow.