WebFunctionRuntime Class Added in v2.276.0
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']),
},
});
Properties
The name of this runtime, as expected by the WebFunction resource.
NODEJS_24_XWebFunctionRuntimenodejs_24_xWebFunctionRuntimeNODEJS_24_XWebFunctionRuntimeNODEJS_24_XWebFunctionRuntimeNODEJS_24_XWebFunctionRuntimestatic#Node.js 24.x runtime.
NODEJS_LATESTWebFunctionRuntimenodejs_latestWebFunctionRuntimeNODEJS_LATESTWebFunctionRuntimeNODEJS_LATESTWebFunctionRuntimeNODEJS_LATESTWebFunctionRuntimestatic#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) WebFunctionRuntimestatic#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.