Runtime Class
Lambda function runtime environment.
If you need to use a runtime name that doesn't exist as a static member, you can instantiate a Runtime object, e.g: new Runtime('nodejs99.99').
For NodeJS lambda functions, it is recommended to use the latest LTS NodeJS runtime available (Runtime.NODEJS_LATEST) to keep the lambda function up-to-date.
| Source | aws-lambda/lib/runtime.ts |
|---|---|
| Type last changed |
Example
ts
const myFunctionHandler = new lambda.Function(this, 'MyFunction', {
code: lambda.Code.fromAsset('resource/myfunction'),
runtime: lambda.Runtime.NODEJS_LATEST,
handler: 'index.handler',
});
const eventRule = cloudtrail.Trail.onEvent(this, 'MyCloudWatchEvent', {
target: new targets.LambdaFunction(myFunctionHandler),
});
eventRule.addEventPattern({
account: ['123456789012'],
source: ['aws.s3'],
});
python
my_function_handler = lambda_.Function(self, "MyFunction",
code=lambda_.Code.from_asset("resource/myfunction"),
runtime=lambda_.Runtime.NODEJS_LATEST,
handler="index.handler"
)
event_rule = cloudtrail.Trail.on_event(self, "MyCloudWatchEvent",
target=targets.LambdaFunction(my_function_handler)
)
event_rule.add_event_pattern(
account=["123456789012"],
source=["aws.s3"]
)
java
Function myFunctionHandler = Function.Builder.create(this, "MyFunction")
.code(Code.fromAsset("resource/myfunction"))
.runtime(Runtime.NODEJS_LATEST)
.handler("index.handler")
.build();
Rule eventRule = Trail.onEvent(this, "MyCloudWatchEvent", OnEventOptions.builder()
.target(new LambdaFunction(myFunctionHandler))
.build());
eventRule.addEventPattern(EventPattern.builder()
.account(List.of("123456789012"))
.source(List.of("aws.s3"))
.build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
var myFunctionHandler = new Function(this, "MyFunction", new FunctionProps {
Code = Code.FromAsset("resource/myfunction"),
Runtime = Runtime.NODEJS_LATEST,
Handler = "index.handler"
});
var eventRule = Trail.OnEvent(this, "MyCloudWatchEvent", new OnEventOptions {
Target = new LambdaFunction(myFunctionHandler)
});
eventRule.AddEventPattern(new EventPattern {
Account = new [] { "123456789012" },
Source = new [] { "aws.s3" }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
myFunctionHandler := lambda.NewFunction(this, jsii.String("MyFunction"), &FunctionProps{
Code: lambda.Code_FromAsset(jsii.String("resource/myfunction")),
Runtime: lambda.Runtime_NODEJS_LATEST(),
Handler: jsii.String("index.handler"),
})
eventRule := cloudtrail.Trail_OnEvent(this, jsii.String("MyCloudWatchEvent"), &OnEventOptions{
Target: targets.NewLambdaFunction(myFunctionHandler),
})
eventRule.AddEventPattern(&EventPattern{
Account: []*string{
jsii.String("123456789012"),
},
Source: []*string{
jsii.String("aws.s3"),
},
})
Initializer
ts
new Runtime(name: string, family?: RuntimeFamily, props?: LambdaRuntimeProps)
python
Runtime(name: str, family: typing.Optional[RuntimeFamily] = None, props: typing.Optional[LambdaRuntimeProps] = None)
java
new Runtime(String name, RuntimeFamily family, LambdaRuntimeProps props)
csharp
new Runtime(string name, RuntimeFamily? family = null, LambdaRuntimeProps? props = null)
go
NewRuntime(Name *string, Family RuntimeFamily, Props LambdaRuntimeProps)
Properties
A list of all known `Runtime`'s.
bundlingImageDockerImagebundling_imageDockerImagebundlingImageDockerImageBundlingImageDockerImageBundlingImageDockerImage #The bundling Docker image for this runtime.
The .NET 10 runtime (dotnet10).
Legacy runtime no longer supported by AWS Lambda. Migrate to the latest .NET runtime.
The .NET 8 runtime (dotnet8).
The .NET 9 runtime (dotnet9).
DOTNET_CORE_1RuntimeDOTNET_CORE_1RuntimeDOTNET_CORE_1RuntimeDOTNET_CORE_1RuntimeDOTNET_CORE_1Runtime static deprecated #Legacy runtime no longer supported by AWS Lambda. Migrate to the latest .NET Core runtime.
DOTNET_CORE_2RuntimeDOTNET_CORE_2RuntimeDOTNET_CORE_2RuntimeDOTNET_CORE_2RuntimeDOTNET_CORE_2Runtime static deprecated #Legacy runtime no longer supported by AWS Lambda. Migrate to the latest .NET Core runtime.
DOTNET_CORE_2_1RuntimeDOTNET_CORE_2_1RuntimeDOTNET_CORE_2_1RuntimeDOTNET_CORE_2_1RuntimeDOTNET_CORE_2_1Runtime static deprecated #Legacy runtime no longer supported by AWS Lambda. Migrate to the latest .NET Core runtime.
DOTNET_CORE_3_1RuntimeDOTNET_CORE_3_1RuntimeDOTNET_CORE_3_1RuntimeDOTNET_CORE_3_1RuntimeDOTNET_CORE_3_1Runtime static deprecated #Legacy runtime no longer supported by AWS Lambda. Migrate to the latest .NET Core runtime.
familymay be undefinedRuntimeFamilyfamilymay be undefinedRuntimeFamilyfamilymay be undefinedRuntimeFamilyFamilymay be undefinedRuntimeFamilyFamilymay be undefinedRuntimeFamily #The runtime family.
A special runtime entry to be used when function is using a docker image.
Legacy runtime no longer supported by AWS Lambda. Migrate to the PROVIDED_AL2023 runtime.
Enabled for runtime enums that always target the latest available.
The Java 11 runtime (java11).
JAVA_11_AL2023RuntimeJAVA_11_AL2023RuntimeJAVA_11_AL2023RuntimeJAVA_11_AL2023RuntimeJAVA_11_AL2023Runtime static #The Java 11 AL2023 runtime (java11.al2023).
The Java 17 runtime (java17).
JAVA_17_AL2023RuntimeJAVA_17_AL2023RuntimeJAVA_17_AL2023RuntimeJAVA_17_AL2023RuntimeJAVA_17_AL2023Runtime static #The Java 17 AL2023 runtime (java17.al2023).
The Java 21 runtime (java21).
The Java 25 runtime (java25).
Legacy runtime no longer supported by AWS Lambda. Migrate to the latest Java runtime.
JAVA_8_AL2023RuntimeJAVA_8_AL2023RuntimeJAVA_8_AL2023RuntimeJAVA_8_AL2023RuntimeJAVA_8_AL2023Runtime static #The Java 8 AL2023 runtime (java8.al2023).
JAVA_8_CORRETTORuntimeJAVA_8_CORRETTORuntimeJAVA_8_CORRETTORuntimeJAVA_8_CORRETTORuntimeJAVA_8_CORRETTORuntime static #The Java 8 Corretto runtime (java8.al2).
The name of this runtime, as expected by the Lambda resource.
Legacy runtime no longer supported by AWS Lambda. Migrate to the latest NodeJS runtime.
NODEJS_10_XRuntimeNODEJS_10_XRuntimeNODEJS_10_XRuntimeNODEJS_10_XRuntimeNODEJS_10_XRuntime static deprecated #Legacy runtime no longer supported by AWS Lambda. Migrate to the latest NodeJS runtime.
NODEJS_12_XRuntimeNODEJS_12_XRuntimeNODEJS_12_XRuntimeNODEJS_12_XRuntimeNODEJS_12_XRuntime static deprecated #Legacy runtime no longer supported by AWS Lambda. Migrate to the latest NodeJS runtime.
NODEJS_14_XRuntimeNODEJS_14_XRuntimeNODEJS_14_XRuntimeNODEJS_14_XRuntimeNODEJS_14_XRuntime static deprecated #Legacy runtime no longer supported by AWS Lambda. Migrate to the latest NodeJS runtime.
NODEJS_16_XRuntimeNODEJS_16_XRuntimeNODEJS_16_XRuntimeNODEJS_16_XRuntimeNODEJS_16_XRuntime static deprecated #Legacy runtime no longer supported by AWS Lambda. Migrate to the latest NodeJS runtime.
NODEJS_18_XRuntimeNODEJS_18_XRuntimeNODEJS_18_XRuntimeNODEJS_18_XRuntimeNODEJS_18_XRuntime static deprecated #Legacy runtime no longer supported by AWS Lambda. Migrate to the latest NodeJS runtime.
The NodeJS 20.x runtime (nodejs20.x).
The NodeJS 22.x runtime (nodejs22.x).
The NodeJS 24.x runtime (nodejs24.x).
The NodeJS 26.x runtime (nodejs26.x).
NODEJS_4_3RuntimeNODEJS_4_3RuntimeNODEJS_4_3RuntimeNODEJS_4_3RuntimeNODEJS_4_3Runtime static deprecated #Legacy runtime no longer supported by AWS Lambda. Migrate to the latest NodeJS runtime.
NODEJS_6_10RuntimeNODEJS_6_10RuntimeNODEJS_6_10RuntimeNODEJS_6_10RuntimeNODEJS_6_10Runtime static deprecated #Legacy runtime no longer supported by AWS Lambda. Migrate to the latest NodeJS runtime.
NODEJS_8_10RuntimeNODEJS_8_10RuntimeNODEJS_8_10RuntimeNODEJS_8_10RuntimeNODEJS_8_10Runtime static deprecated #Legacy runtime no longer supported by AWS Lambda. Migrate to the latest NodeJS runtime.
NODEJS_LATESTRuntimeNODEJS_LATESTRuntimeNODEJS_LATESTRuntimeNODEJS_LATESTRuntimeNODEJS_LATESTRuntime static #The latest NodeJS version currently available in ALL regions (not necessarily the latest NodeJS version available in YOUR region).
Legacy runtime no longer supported by AWS Lambda. Migrate to the latest provided.al2023 runtime.
PROVIDED_AL2RuntimePROVIDED_AL2RuntimePROVIDED_AL2RuntimePROVIDED_AL2RuntimePROVIDED_AL2Runtime static #The custom provided runtime with Amazon Linux 2 (provided.al2).
PROVIDED_AL2023RuntimePROVIDED_AL2023RuntimePROVIDED_AL2023RuntimePROVIDED_AL2023RuntimePROVIDED_AL2023Runtime static #The custom provided runtime with Amazon Linux 2023 (provided.al2023).
PYTHON_2_7RuntimePYTHON_2_7RuntimePYTHON_2_7RuntimePYTHON_2_7RuntimePYTHON_2_7Runtime static deprecated #Legacy runtime no longer supported by AWS Lambda. Migrate to the latest Python runtime.
The Python 3.10 runtime (python3.10).
The Python 3.11 runtime (python3.11).
The Python 3.12 runtime (python3.12).
The Python 3.13 runtime (python3.13).
The Python 3.14 runtime (python3.14).
The Python 3.15 runtime (python3.15).
PYTHON_3_6RuntimePYTHON_3_6RuntimePYTHON_3_6RuntimePYTHON_3_6RuntimePYTHON_3_6Runtime static deprecated #Legacy runtime no longer supported by AWS Lambda. Migrate to the latest Python runtime.
The Python 3.6 runtime is deprecated as of July 2022.
PYTHON_3_7RuntimePYTHON_3_7RuntimePYTHON_3_7RuntimePYTHON_3_7RuntimePYTHON_3_7Runtime static deprecated #Legacy runtime no longer supported by AWS Lambda. Migrate to the latest Python runtime.
PYTHON_3_8RuntimePYTHON_3_8RuntimePYTHON_3_8RuntimePYTHON_3_8RuntimePYTHON_3_8Runtime static deprecated #Legacy runtime no longer supported by AWS Lambda. Migrate to the latest Python runtime.
PYTHON_3_9RuntimePYTHON_3_9RuntimePYTHON_3_9RuntimePYTHON_3_9RuntimePYTHON_3_9Runtime static deprecated #Legacy runtime no longer supported by AWS Lambda. Migrate to the latest Python runtime.
Legacy runtime no longer supported by AWS Lambda. Migrate to the latest Ruby runtime.
Legacy runtime no longer supported by AWS Lambda. Migrate to the latest Ruby runtime.
The Ruby 3.2 runtime (ruby3.2).
The Ruby 3.3 runtime (ruby3.3).
The Ruby 3.4 runtime (ruby3.4).
The Ruby 4.0 runtime (ruby4.0).
supportsCodeGuruProfilingbooleansupports_code_guru_profilingboolsupportsCodeGuruProfilingBooleanSupportsCodeGuruProfilingboolSupportsCodeGuruProfiling*bool #Whether this runtime is integrated with and supported for profiling using Amazon CodeGuru Profiler.
supportsInlineCodebooleansupports_inline_codeboolsupportsInlineCodeBooleanSupportsInlineCodeboolSupportsInlineCode*bool #Whether the ``ZipFile`` (aka inline code) property can be used with this runtime.
supportsSnapStartbooleansupports_snap_startboolsupportsSnapStartBooleanSupportsSnapStartboolSupportsSnapStart*bool #Whether this runtime supports snapstart.
Methods
determineLatestPythonRuntime(scope: Construct): Runtime // chainable@staticmethod def determine_latest_python_runtime(scope: Construct) -> Runtimepublic static Runtime determineLatestPythonRuntime(Construct scope)public static Runtime DetermineLatestPythonRuntime(Construct scope)func DetermineLatestPythonRuntime(Scope Construct) Runtime static #The latest Python version currently available.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string #