LayerVersionProps Struct
Example
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
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
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();
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 }
});
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
The content of this Layer.
Using Code.fromInline is not supported.
compatibleArchitecturesoptionalArchitecture[]compatible_architecturesoptionaltyping.List[Architecture]compatibleArchitecturesoptionalList<Architecture>CompatibleArchitecturesoptionalArchitecture[]CompatibleArchitecturesoptional*[]Architecture= [Architecture.X86_64]#The system architectures compatible with this layer.
compatibleRuntimesoptionalRuntime[]compatible_runtimesoptionaltyping.List[Runtime]compatibleRuntimesoptionalList<Runtime>CompatibleRuntimesoptionalRuntime[]CompatibleRuntimesoptional*[]Runtime#The runtimes compatible with this Layer.
Default: All runtimes are supported.
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string#The description the this Lambda Layer.
Default: No description.
layerVersionNameoptionalstringlayer_version_nameoptionalstrlayerVersionNameoptionalStringLayerVersionNameoptionalstringLayerVersionNameoptional*string#The name of the layer.
Default: A name will be generated.
licenseoptionalstringlicenseoptionalstrlicenseoptionalStringLicenseoptionalstringLicenseoptional*string#The SPDX licence identifier or URL to the license file for this layer.
Default: No license information will be recorded.
removalPolicyoptionalRemovalPolicyremoval_policyoptionalRemovalPolicyremovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicy= RemovalPolicy.DESTROY#Whether to retain this version of the layer when a new version is added or when the stack is deleted.