Class LayerVersion

All Implemented Interfaces:
IConstruct, IDependable, IResource, ILayerVersion,, software.constructs.IConstruct
Direct Known Subclasses:
AwsCliLayer, KubectlLayer, NodeProxyAgentLayer, PythonLayerVersion

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:40.798Z") @Stability(Stable) public class LayerVersion extends Resource implements ILayerVersion
Defines a new Lambda Layer version.


 LayerVersion.Builder.create(this, "MyLayer")
         .code(Code.fromAsset(join(__dirname, "lambda-handler")))
         .compatibleArchitectures(List.of(Architecture.X86_64, Architecture.ARM_64))
  • Constructor Details

    • LayerVersion

      protected LayerVersion( objRef)
    • LayerVersion

      protected LayerVersion( initializationMode)
    • LayerVersion

      @Stability(Stable) public LayerVersion(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull LayerVersionProps props)
      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.

      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.

      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:GetLayerVersion permission on the layer version.

      Specified by:
      addPermission in interface ILayerVersion
      id - This parameter is required.
      permission - This parameter is required.
    • getLayerVersionArn

      @Stability(Stable) @NotNull public String getLayerVersionArn()
      The ARN of the Lambda Layer version that this Layer defines.
      Specified by:
      getLayerVersionArn in interface ILayerVersion
    • getCompatibleRuntimes

      @Stability(Stable) @Nullable public List<Runtime> getCompatibleRuntimes()
      The runtimes compatible with this Layer.
      Specified by:
      getCompatibleRuntimes in interface ILayerVersion