# WebFunctionRuntime

Runtime environment for WebFunction.

- Source: [`aws-lambda/lib/webfunction-runtime.ts`](https://github.com/aws/aws-cdk/blob/v2.276.0/packages/aws-cdk-lib/aws-lambda/lib/webfunction-runtime.ts#L4)
- Type last changed: v2.276.0 · 10 Nov 2026

## Example

```ts
import * as s3 from 'aws-cdk-lib/aws-s3';

declare const codeBucket: s3.IBucket;

new lambda.WebFunction(this, 'PerRegionApi', {
  code: lambda.WebFunctionCode.fromBucket(codeBucket, 'app.zip', 'version-id'),
  runtime: lambda.WebFunctionRuntime.NODEJS_24_X,
  defaultEndpointAuth: lambda.WebFunctionAuthType.IAM_AUTH,
  defaultEndpoint: {
    endpointLocation: lambda.WebFunctionEndpointLocation.perRegion(['us-east-1', 'us-west-2']),
  },
});
```

## Properties

- `name`: string — The name of this runtime, as expected by the WebFunction resource.

- `NODEJS_24_X`: [WebFunctionRuntime](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.WebFunctionRuntime.html) (static) — Node.js 24.x runtime.

- `NODEJS_LATEST`: [WebFunctionRuntime](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.WebFunctionRuntime.html) (static) — The latest NodeJS version currently available in ALL regions (not necessarily the latest NodeJS version available in YOUR region).

  This value changes as new Node.js runtimes become available; it currently resolves to
  Node.js 24.x. The runtime is part of a revision's build configuration, so when an
  upgrade of the CDK library moves this to a newer runtime, the next deployment creates a
  new revision on it and shifts the endpoint's traffic there — without any change to your
  code. Use a specific version such as `NODEJS_24_X` to control when that happens.

## Methods

- `of(name: string): WebFunctionRuntime // chainable` (static) — Use a custom runtime string not yet supported by the CDK.

  This allows customers to use a newly released runtime without waiting
  for a CDK library update.

  **Parameters**

  - `name` — The runtime identifier (e.g. 'nodejs26.x').

- `toString(): string` — Returns the runtime name.
