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.
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_imageDockerImagebundlingImageDockerImageBundlingImageDockerImageBundlingImageDockerImagerequired#The bundling Docker image for this runtime.
The .NET 10 runtime (dotnet10).
DOTNET_6Runtimedotnet_6RuntimeDOTNET_6RuntimeDOTNET_6RuntimeDOTNET_6Runtimerequiredstaticdeprecated#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_1Runtimerequiredstaticdeprecated#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_2Runtimerequiredstaticdeprecated#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_1Runtimerequiredstaticdeprecated#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_1Runtimerequiredstaticdeprecated#Legacy runtime no longer supported by AWS Lambda. Migrate to the latest .NET Core runtime.
The runtime family.
FROM_IMAGERuntimefrom_imageRuntimeFROM_IMAGERuntimeFROM_IMAGERuntimeFROM_IMAGERuntimerequiredstatic#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_AL2023Runtimerequiredstatic#The Java 11 AL2023 runtime (java11.al2023).
The Java 17 runtime (java17).
JAVA_17_AL2023Runtimejava_17_al2023RuntimeJAVA_17_AL2023RuntimeJAVA_17_AL2023RuntimeJAVA_17_AL2023Runtimerequiredstatic#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_AL2023Runtimerequiredstatic#The Java 8 AL2023 runtime (java8.al2023).
JAVA_8_CORRETTORuntimejava_8_correttoRuntimeJAVA_8_CORRETTORuntimeJAVA_8_CORRETTORuntimeJAVA_8_CORRETTORuntimerequiredstatic#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_XRuntimerequiredstaticdeprecated#Legacy runtime no longer supported by AWS Lambda. Migrate to the latest NodeJS runtime.
NODEJS_12_XRuntimenodejs_12_xRuntimeNODEJS_12_XRuntimeNODEJS_12_XRuntimeNODEJS_12_XRuntimerequiredstaticdeprecated#Legacy runtime no longer supported by AWS Lambda. Migrate to the latest NodeJS runtime.
NODEJS_14_XRuntimenodejs_14_xRuntimeNODEJS_14_XRuntimeNODEJS_14_XRuntimeNODEJS_14_XRuntimerequiredstaticdeprecated#Legacy runtime no longer supported by AWS Lambda. Migrate to the latest NodeJS runtime.
NODEJS_16_XRuntimenodejs_16_xRuntimeNODEJS_16_XRuntimeNODEJS_16_XRuntimeNODEJS_16_XRuntimerequiredstaticdeprecated#Legacy runtime no longer supported by AWS Lambda. Migrate to the latest NodeJS runtime.
NODEJS_18_XRuntimenodejs_18_xRuntimeNODEJS_18_XRuntimeNODEJS_18_XRuntimeNODEJS_18_XRuntimerequiredstaticdeprecated#Legacy runtime no longer supported by AWS Lambda. Migrate to the latest NodeJS runtime.
NODEJS_20_XRuntimenodejs_20_xRuntimeNODEJS_20_XRuntimeNODEJS_20_XRuntimeNODEJS_20_XRuntimerequiredstatic#The NodeJS 20.x runtime (nodejs20.x).
NODEJS_22_XRuntimenodejs_22_xRuntimeNODEJS_22_XRuntimeNODEJS_22_XRuntimeNODEJS_22_XRuntimerequiredstatic#The NodeJS 22.x runtime (nodejs22.x).
NODEJS_24_XRuntimenodejs_24_xRuntimeNODEJS_24_XRuntimeNODEJS_24_XRuntimeNODEJS_24_XRuntimerequiredstatic#The NodeJS 24.x runtime (nodejs24.x).
NODEJS_4_3Runtimenodejs_4_3RuntimeNODEJS_4_3RuntimeNODEJS_4_3RuntimeNODEJS_4_3Runtimerequiredstaticdeprecated#Legacy runtime no longer supported by AWS Lambda. Migrate to the latest NodeJS runtime.
NODEJS_6_10Runtimenodejs_6_10RuntimeNODEJS_6_10RuntimeNODEJS_6_10RuntimeNODEJS_6_10Runtimerequiredstaticdeprecated#Legacy runtime no longer supported by AWS Lambda. Migrate to the latest NodeJS runtime.
NODEJS_8_10Runtimenodejs_8_10RuntimeNODEJS_8_10RuntimeNODEJS_8_10RuntimeNODEJS_8_10Runtimerequiredstaticdeprecated#Legacy runtime no longer supported by AWS Lambda. Migrate to the latest NodeJS runtime.
NODEJS_LATESTRuntimenodejs_latestRuntimeNODEJS_LATESTRuntimeNODEJS_LATESTRuntimeNODEJS_LATESTRuntimerequiredstatic#The latest NodeJS version currently available in ALL regions (not necessarily the latest NodeJS version available in YOUR region).
PROVIDEDRuntimeprovidedRuntimePROVIDEDRuntimePROVIDEDRuntimePROVIDEDRuntimerequiredstaticdeprecated#Legacy runtime no longer supported by AWS Lambda. Migrate to the latest provided.al2023 runtime.
PROVIDED_AL2Runtimeprovided_al2RuntimePROVIDED_AL2RuntimePROVIDED_AL2RuntimePROVIDED_AL2Runtimerequiredstatic#The custom provided runtime with Amazon Linux 2 (provided.al2).
PROVIDED_AL2023Runtimeprovided_al2023RuntimePROVIDED_AL2023RuntimePROVIDED_AL2023RuntimePROVIDED_AL2023Runtimerequiredstatic#The custom provided runtime with Amazon Linux 2023 (provided.al2023).
PYTHON_2_7Runtimepython_2_7RuntimePYTHON_2_7RuntimePYTHON_2_7RuntimePYTHON_2_7Runtimerequiredstaticdeprecated#Legacy runtime no longer supported by AWS Lambda. Migrate to the latest Python runtime.
PYTHON_3_10Runtimepython_3_10RuntimePYTHON_3_10RuntimePYTHON_3_10RuntimePYTHON_3_10Runtimerequiredstatic#The Python 3.10 runtime (python3.10).
PYTHON_3_11Runtimepython_3_11RuntimePYTHON_3_11RuntimePYTHON_3_11RuntimePYTHON_3_11Runtimerequiredstatic#The Python 3.11 runtime (python3.11).
PYTHON_3_12Runtimepython_3_12RuntimePYTHON_3_12RuntimePYTHON_3_12RuntimePYTHON_3_12Runtimerequiredstatic#The Python 3.12 runtime (python3.12).
PYTHON_3_13Runtimepython_3_13RuntimePYTHON_3_13RuntimePYTHON_3_13RuntimePYTHON_3_13Runtimerequiredstatic#The Python 3.13 runtime (python3.13).
PYTHON_3_14Runtimepython_3_14RuntimePYTHON_3_14RuntimePYTHON_3_14RuntimePYTHON_3_14Runtimerequiredstatic#The Python 3.14 runtime (python3.14).
PYTHON_3_6Runtimepython_3_6RuntimePYTHON_3_6RuntimePYTHON_3_6RuntimePYTHON_3_6Runtimerequiredstaticdeprecated#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_7Runtimerequiredstaticdeprecated#Legacy runtime no longer supported by AWS Lambda. Migrate to the latest Python runtime.
PYTHON_3_8Runtimepython_3_8RuntimePYTHON_3_8RuntimePYTHON_3_8RuntimePYTHON_3_8Runtimerequiredstaticdeprecated#Legacy runtime no longer supported by AWS Lambda. Migrate to the latest Python runtime.
PYTHON_3_9Runtimepython_3_9RuntimePYTHON_3_9RuntimePYTHON_3_9RuntimePYTHON_3_9Runtimerequiredstaticdeprecated#Legacy runtime no longer supported by AWS Lambda. Migrate to the latest Python runtime.
RUBY_2_5Runtimeruby_2_5RuntimeRUBY_2_5RuntimeRUBY_2_5RuntimeRUBY_2_5Runtimerequiredstaticdeprecated#Legacy runtime no longer supported by AWS Lambda. Migrate to the latest Ruby runtime.
RUBY_2_7Runtimeruby_2_7RuntimeRUBY_2_7RuntimeRUBY_2_7RuntimeRUBY_2_7Runtimerequiredstaticdeprecated#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*boolrequired#Whether this runtime is integrated with and supported for profiling using Amazon CodeGuru Profiler.
supportsInlineCodebooleansupports_inline_codeboolsupportsInlineCodeBooleanSupportsInlineCodeboolSupportsInlineCode*boolrequired#Whether the ``ZipFile`` (aka inline code) property can be used with this runtime.
supportsSnapStartbooleansupports_snap_startboolsupportsSnapStartBooleanSupportsSnapStartboolSupportsSnapStart*boolrequired#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) Runtimestatic#The latest Python version currently available.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#