# LayerVersionProps

Extends: [LayerVersionOptions](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.LayerVersionOptions.html)
Used as props by: [LayerVersion](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.LayerVersion.html)

- Source: [`aws-lambda/lib/layers.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/aws-lambda/lib/layers.ts#L54)

## Example

TypeScript:

```ts
new lambda.LayerVersion(this, 'MyLayer', {
  removalPolicy: RemovalPolicy.RETAIN,
  code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')),
  compatibleArchitectures: [lambda.Architecture.X86_64, lambda.Architecture.ARM_64],
});
```

Python:

```python
lambda_.LayerVersion(self, "MyLayer",
    removal_policy=RemovalPolicy.RETAIN,
    code=lambda_.Code.from_asset(path.join(__dirname, "lambda-handler")),
    compatible_architectures=[lambda_.Architecture.X86_64, lambda_.Architecture.ARM_64]
)
```

Java:

```java
LayerVersion.Builder.create(this, "MyLayer")
        .removalPolicy(RemovalPolicy.RETAIN)
        .code(Code.fromAsset(join(__dirname, "lambda-handler")))
        .compatibleArchitectures(List.of(Architecture.X86_64, Architecture.ARM_64))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
new LayerVersion(this, "MyLayer", new LayerVersionProps {
    RemovalPolicy = RemovalPolicy.RETAIN,
    Code = Code.FromAsset(Join(__dirname, "lambda-handler")),
    CompatibleArchitectures = new [] { Architecture.X86_64, Architecture.ARM_64 }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
lambda.NewLayerVersion(this, jsii.String("MyLayer"), &LayerVersionProps{
	RemovalPolicy: awscdk.RemovalPolicy_RETAIN,
	Code: lambda.Code_FromAsset(path.join(__dirname, jsii.String("lambda-handler"))),
	CompatibleArchitectures: []Architecture{
		lambda.Architecture_X86_64(),
		lambda.Architecture_ARM_64(),
	},
})
```

## Properties

- `code`: [Code](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Code.html) (required) — The content of this Layer.

  Using `Code.fromInline` is not supported.

- `compatibleArchitectures`: [Architecture](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Architecture.html)[] = [Architecture.X86_64] — The system architectures compatible with this layer.

- `compatibleRuntimes`: [Runtime](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Runtime.html)[] — The runtimes compatible with this Layer.

  **Default:** All runtimes are supported.

- `description`: string — The description the this Lambda Layer.

  **Default:** No description.

- `layerVersionName`: string — The name of the layer.

  **Default:** A name will be generated.

- `license`: string — The SPDX licence identifier or URL to the license file for this layer.

  **Default:** No license information will be recorded.

- `removalPolicy`: [RemovalPolicy](/cdk/api/v2/docs/aws-cdk-lib.RemovalPolicy.html) = RemovalPolicy.DESTROY — Whether to retain this version of the layer when a new version is added or when the stack is deleted.
