
# AWS Lambda

`--platform aws` writes `build/aws/` with `index.mjs`, `main.cjs` and `prelude.js`. Zip the directory; the runtime is Node.js 22 and the handler `index.handler`. See [Building](building.md).

## The triggers

The entry answers the four HTTP triggers: a function URL and an API Gateway HTTP API (payload 2.0), an API Gateway REST API (payload 1.0) and an Application Load Balancer.

- The event becomes a request, the response the result the trigger expects: text as text, anything else as base64, cookies where the trigger wants them.
- The address of the client is the event's `sourceIp`; behind a load balancer, the last address of `X-Forwarded-For`, which the balancer adds itself.
- `process.env` is the application's environment.

## Streaming

A response is buffered by default: an event stream arrives when it ended. `--streaming` writes a response-streaming handler for a function URL with `InvokeMode: RESPONSE_STREAM`; then the body is sent while it is written. AWS's emulator does not stream, so the starter's tests check this handler with a stand-in for the runtime's `awslambda`.

```bash
dart run spring_boot_starter_edge:build --platform aws --streaming
```

On AWS the invocation ends when the work after the response did (see [`waitUntil`](differences.md#work-after-the-answer)).

## Schedules

An EventBridge rule or schedule with the function as its target runs the application's `EdgeScheduledHandler` beans; `event.schedule` is the rule's ARN. See [Work by a schedule](differences.md#work-by-a-schedule).

## See also

- [Deploying a function](deploying.md#aws-lambda): the steps to deploy, by hand and from GitHub Actions
- [What a function does differently](differences.md)
- [All properties](properties.md)
