# FunctionRuntimeConfig

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.

Extends: [Mixin](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Mixin.html) › FunctionRuntimeConfig
Implements: [IMixin](https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.IMixin.html)

- Source: [`aws-lambda/lib/mixins/function.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-lambda/lib/mixins/function.ts#L45)
- Type last changed: v2.278.0 · 20 Nov 2026

## Example

TypeScript:

```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:

```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:

```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());
```

C# / .NET:

```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"
}));
```

Golang:

```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

TypeScript:

```ts
new FunctionRuntimeConfig(props: FunctionRuntimeConfigProps)
```

Python:

```python
FunctionRuntimeConfig(props: FunctionRuntimeConfigProps)
```

Java:

```java
new FunctionRuntimeConfig(FunctionRuntimeConfigProps props)
```

C# / .NET:

```csharp
new FunctionRuntimeConfig(FunctionRuntimeConfigProps props)
```

Golang:

```go
NewFunctionRuntimeConfig(Props FunctionRuntimeConfigProps)
```

## Methods

- `applyTo(construct: IConstruct): void` — Applies the mixin functionality to the target construct.

- `isMixin(x: any): boolean` (static) — Checks if `x` is a Mixin.

  **Parameters**

  - `x` — Any object.

  **Returns:** true if `x` is an object created from a class which extends `Mixin`.

- `supports(construct: IConstruct): boolean` — Determines whether this mixin can be applied to the given construct.
