FunctionRuntimeConfig Mixin Added in v2.278.0
Lambda-specific Mixin to run a function on a customer-managed runtime (CMR).
Sets the runtimeConfig property on the function, replacing any existing runtimeConfig. The function's runtime must be custom, and the function must not be a container image function; both are checked at synthesis, so a runtime or package type set after the mixin is applied is still checked. A runtime that is only known at deployment, such as a parameter value, is not checked.
Which runtime versions and architectures the runtime supports, and whether the calling account may use it, are validated by the service at deployment.
| Source | aws-lambda/lib/mixins/function.ts |
|---|---|
| Type last changed |
Example
ts
new lambda.Function(this, 'MyFunction', {
runtime: new lambda.Runtime('custom', lambda.RuntimeFamily.OTHER),
handler: 'index.handler',
code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')),
}).with(new lambda.mixins.FunctionRuntimeConfig({
runtimeArn: 'arn:aws:lambda:us-east-1:123456789012:runtime/my-python-runtime',
runtimeAlias: 'stable',
}));
python
lambda_.Function(self, "MyFunction",
runtime=lambda_.Runtime("custom", lambda_.RuntimeFamily.OTHER),
handler="index.handler",
code=lambda_.Code.from_asset(path.join(__dirname, "lambda-handler"))
).with(lambda_.mixins.FunctionRuntimeConfig(
runtime_arn="arn:aws:lambda:us-east-1:123456789012:runtime/my-python-runtime",
runtime_alias="stable"
))
java
Function.Builder.create(this, "MyFunction")
.runtime(new Runtime("custom", lambda.RuntimeFamily.OTHER))
.handler("index.handler")
.code(lambda.Code.fromAsset(join(__dirname, "lambda-handler")))
.build().with(FunctionRuntimeConfig.Builder.create()
.runtimeArn("arn:aws:lambda:us-east-1:123456789012:runtime/my-python-runtime")
.runtimeAlias("stable")
.build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
new Function(this, "MyFunction", new FunctionProps {
Runtime = new Runtime("custom", RuntimeFamily.OTHER),
Handler = "index.handler",
Code = Code.FromAsset(Join(__dirname, "lambda-handler"))
}).With(new Mixins.FunctionRuntimeConfig(new FunctionRuntimeConfigProps {
RuntimeArn = "arn:aws:lambda:us-east-1:123456789012:runtime/my-python-runtime",
RuntimeAlias = "stable"
}));
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
lambda.NewFunction(this, jsii.String("MyFunction"), &FunctionProps{
Runtime: lambda.NewRuntime(jsii.String("custom"), lambda.RuntimeFamily_OTHER),
Handler: jsii.String("index.handler"),
Code: lambda.Code_FromAsset(path.join(__dirname, jsii.String("lambda-handler"))),
}).With(mixins.NewFunctionRuntimeConfig(&FunctionRuntimeConfigProps{
RuntimeArn: jsii.String("arn:aws:lambda:us-east-1:123456789012:runtime/my-python-runtime"),
RuntimeAlias: jsii.String("stable"),
}))
Initializer
ts
new FunctionRuntimeConfig(props: FunctionRuntimeConfigProps)
python
FunctionRuntimeConfig(props: FunctionRuntimeConfigProps)
java
new FunctionRuntimeConfig(FunctionRuntimeConfigProps props)
csharp
new FunctionRuntimeConfig(FunctionRuntimeConfigProps props)
go
NewFunctionRuntimeConfig(Props FunctionRuntimeConfigProps)
Methods
applyTo(construct: IConstruct): voiddef apply_to(self, construct: IConstruct) -> Nonepublic void applyTo(IConstruct construct)public void ApplyTo(IConstruct construct)func ApplyTo(Construct IConstruct) #Applies the mixin functionality to the target construct.
isMixin(x: any): boolean@staticmethod def is_mixin(x: Any) -> boolpublic static Boolean isMixin(Object x)public static bool IsMixin(object x)func IsMixin(X interface{}) *bool static #Checks if `x` is a Mixin.
1 parameter · returns
Parameters
xxxxX— Any object.
Returns: true if x is an object created from a class which extends Mixin.
supports(construct: IConstruct): booleandef supports(self, construct: IConstruct) -> boolpublic Boolean supports(IConstruct construct)public bool Supports(IConstruct construct)func Supports(Construct IConstruct) *bool #Determines whether this mixin can be applied to the given construct.