Class LayerVersion
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.lambda.LayerVersion
- All Implemented Interfaces:
IEnvironmentAware,ILayerVersionRef,IResource,ILayerVersion,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
- Direct Known Subclasses:
AwsCliLayer,NodeProxyAgentLayer,PythonLayerVersion
@Generated(value="jsii-pacmak/1.121.0 (build d7af9b9)",
date="2025-12-18T18:20:12.809Z")
@Stability(Stable)
public class LayerVersion
extends Resource
implements ILayerVersion
Defines a new Lambda Layer version.
Example:
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();
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.lambda.ILayerVersion
ILayerVersion.Jsii$Default, ILayerVersion.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLayerVersion(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedLayerVersion(software.amazon.jsii.JsiiObjectRef objRef) LayerVersion(software.constructs.Construct scope, String id, LayerVersionProps props) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPermission(String id, LayerVersionPermission permission) Add permission for this layer version to specific entities.static ILayerVersionfromLayerVersionArn(software.constructs.Construct scope, String id, String layerVersionArn) Imports a layer version by ARN.static ILayerVersionfromLayerVersionAttributes(software.constructs.Construct scope, String id, LayerVersionAttributes attrs) Imports a Layer that has been defined externally.The runtimes compatible with this Layer.The ARN of the Lambda Layer version that this Layer defines.A reference to a LayerVersion resource.Methods inherited from class software.amazon.awscdk.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResourceMethods inherited from class software.constructs.Construct
getNode, isConstruct, toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.amazon.awscdk.services.lambda.ILayerVersion
getEnv, getNodeMethods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getStackMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PROPERTY_INJECTION_ID
Uniquely identifies this class.
-
-
Constructor Details
-
LayerVersion
protected LayerVersion(software.amazon.jsii.JsiiObjectRef objRef) -
LayerVersion
protected LayerVersion(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
LayerVersion
@Stability(Stable) public LayerVersion(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull LayerVersionProps props) - Parameters:
scope- This parameter is required.id- This parameter is required.props- This parameter is required.
-
-
Method Details
-
fromLayerVersionArn
@Stability(Stable) @NotNull public static ILayerVersion fromLayerVersionArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String layerVersionArn) Imports a layer version by ARN.Assumes it is compatible with all Lambda runtimes.
- Parameters:
scope- This parameter is required.id- This parameter is required.layerVersionArn- This parameter is required.
-
fromLayerVersionAttributes
@Stability(Stable) @NotNull public static ILayerVersion fromLayerVersionAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull LayerVersionAttributes attrs) Imports a Layer that has been defined externally.- Parameters:
scope- the parent Construct that will use the imported layer. This parameter is required.id- the id of the imported layer in the construct tree. This parameter is required.attrs- the properties of the imported layer. This parameter is required.
-
addPermission
@Stability(Stable) public void addPermission(@NotNull String id, @NotNull LayerVersionPermission permission) Add permission for this layer version to specific entities.Usage within the same account where the layer is defined is always allowed and does not require calling this method. Note that the principal that creates the Lambda function using the layer (for example, a CloudFormation changeset execution role) also needs to have the
lambda:GetLayerVersionpermission on the layer version.- Specified by:
addPermissionin interfaceILayerVersion- Parameters:
id- This parameter is required.permission- This parameter is required.
-
getLayerVersionArn
The ARN of the Lambda Layer version that this Layer defines.- Specified by:
getLayerVersionArnin interfaceILayerVersion
-
getLayerVersionRef
A reference to a LayerVersion resource.- Specified by:
getLayerVersionRefin interfaceILayerVersionRef
-
getCompatibleRuntimes
The runtimes compatible with this Layer.- Specified by:
getCompatibleRuntimesin interfaceILayerVersion
-