# WebFunctionRuntime

Runtime environment for WebFunction.

Obtainable from: WebFunctionRuntime.NODEJS_24_X, WebFunctionRuntime.NODEJS_LATEST, WebFunctionRuntime.of

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

## Example

TypeScript:

```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']),
  },
});
```

Python:

```python
import aws_cdk.aws_s3 as s3

# code_bucket: s3.IBucket

lambda_.WebFunction(self, "PerRegionApi",
    code=lambda_.WebFunctionCode.from_bucket(code_bucket, "app.zip", "version-id"),
    runtime=lambda_.WebFunctionRuntime.NODEJS_24_X,
    default_endpoint_auth=lambda_.WebFunctionAuthType.IAM_AUTH,
    default_endpoint=lambda.WebFunctionDefaultEndpointOptions(
        endpoint_location=lambda_.WebFunctionEndpointLocation.per_region(["us-east-1", "us-west-2"])
    )
)
```

Java:

```java
import software.amazon.awscdk.services.s3.*;

IBucket codeBucket;

WebFunction.Builder.create(this, "PerRegionApi")
        .code(WebFunctionCode.fromBucket(codeBucket, "app.zip", "version-id"))
        .runtime(WebFunctionRuntime.NODEJS_24_X)
        .defaultEndpointAuth(WebFunctionAuthType.IAM_AUTH)
        .defaultEndpoint(WebFunctionDefaultEndpointOptions.builder()
                .endpointLocation(WebFunctionEndpointLocation.perRegion(List.of("us-east-1", "us-west-2")))
                .build())
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.S3;

IBucket codeBucket;

new WebFunction(this, "PerRegionApi", new WebFunctionProps {
    Code = WebFunctionCode.FromBucket(codeBucket, "app.zip", "version-id"),
    Runtime = WebFunctionRuntime.NODEJS_24_X,
    DefaultEndpointAuth = WebFunctionAuthType.IAM_AUTH,
    DefaultEndpoint = new WebFunctionDefaultEndpointOptions {
        EndpointLocation = WebFunctionEndpointLocation.PerRegion(new [] { "us-east-1", "us-west-2" })
    }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import s3 "github.com/aws/aws-cdk-go/awscdk"

var codeBucket IBucket

lambda.NewWebFunction(this, jsii.String("PerRegionApi"), &WebFunctionProps{
	Code: lambda.WebFunctionCode_FromBucket(codeBucket, jsii.String("app.zip"), jsii.String("version-id")),
	Runtime: lambda.WebFunctionRuntime_NODEJS_24_X(),
	DefaultEndpointAuth: lambda.WebFunctionAuthType_IAM_AUTH,
	DefaultEndpoint: &WebFunctionDefaultEndpointOptions{
		EndpointLocation: lambda.WebFunctionEndpointLocation_PerRegion([]*string{
			jsii.String("us-east-1"),
			jsii.String("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.
