Skip to content

Local listen

Your app listens on

AWS_LAMBDA_HTTP_ENDPOINT
Environment variable host:port that your HTTP server must listen on. Lambda sets it in the cloud; set it yourself for local runs (for example 127.0.0.1:3000).

(host:port). Locally you set it; on Lambda, Lambda sets it. Same listen code either way.

From the repo root:

Terminal window
cd demo
Terminal window
npm install
added 65 packages, and audited 66 packages in 1s
Terminal window
AWS_LAMBDA_HTTP_ENDPOINT=127.0.0.1:3000 npm start
> wf-hello-demo@1.0.0 start
> node index.js
Server listening on 127.0.0.1:3000

Leave that process running. In another terminal:

Terminal window
curl http://127.0.0.1:3000/
{"message":"Hello from Lambda Web Functions!","path":"/"}
Terminal window
curl http://127.0.0.1:3000/health
{"status":"healthy"}

Any server that binds AWS_LAMBDA_HTTP_ENDPOINT works — including the console Hello World template later.