Skip to content
v2.277.0

WebFunctionRuntime Class ​

Runtime environment for WebFunction.

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']),
  },
});
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
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();
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" })
    }
});
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 ​

namestringnamestrnameStringNamestringName*string #
The name of this runtime, as expected by the WebFunction resource.
NODEJS_24_XWebFunctionRuntimeNODEJS_24_XWebFunctionRuntimeNODEJS_24_XWebFunctionRuntimeNODEJS_24_XWebFunctionRuntimeNODEJS_24_XWebFunctionRuntime static #
Node.js 24.x runtime.
NODEJS_LATESTWebFunctionRuntimeNODEJS_LATESTWebFunctionRuntimeNODEJS_LATESTWebFunctionRuntimeNODEJS_LATESTWebFunctionRuntimeNODEJS_LATESTWebFunctionRuntime static #
The latest NodeJS version currently available in ALL regions (not necessarily the latest NodeJS version available in YOUR region).
notes

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@staticmethod def of(name: str) -> WebFunctionRuntimepublic static WebFunctionRuntime of(String name)public static WebFunctionRuntime Of(string name)func Of(Name *string) WebFunctionRuntime 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.

1 parameter

Parameters

  • namenamenamenameName — The runtime identifier (e.g. 'nodejs26.x').
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string #
Returns the runtime name.