Class LayerVersion


  • public class LayerVersion
    extends com.pulumi.resources.CustomResource
    Provides a Lambda Layer Version resource. Lambda Layers allow you to reuse shared bits of code across multiple lambda functions. For information about Lambda Layers and how to use them, see [AWS Lambda Layers](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html). > **NOTE:** Setting `skip_destroy` to `true` means that the AWS Provider will _not_ destroy any layer version, even when running destroy. Layer versions are thus intentional dangling resources that are _not_ managed by the provider and may incur extra expense in your AWS account. ## Example Usage <!--Start PulumiCodeChooser -->
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.lambda.LayerVersion;
     import com.pulumi.aws.lambda.LayerVersionArgs;
     import com.pulumi.asset.FileArchive;
     import java.util.List;
     import java.util.ArrayList;
     import java.util.Map;
     import java.io.File;
     import java.nio.file.Files;
     import java.nio.file.Paths;
     
     public class App {
         public static void main(String[] args) {
             Pulumi.run(App::stack);
         }
     
         public static void stack(Context ctx) {
             var lambdaLayer = new LayerVersion("lambdaLayer", LayerVersionArgs.builder()
                 .code(new FileArchive("lambda_layer_payload.zip"))
                 .layerName("lambda_layer_name")
                 .compatibleRuntimes("nodejs20.x")
                 .build());
     
         }
     }
     
     
    <!--End PulumiCodeChooser --> ## Specifying the Deployment Package AWS Lambda Layers expect source code to be provided as a deployment package whose structure varies depending on which `compatible_runtimes` this layer specifies. See [Runtimes](https://docs.aws.amazon.com/lambda/latest/dg/API_PublishLayerVersion.html#SSS-PublishLayerVersion-request-CompatibleRuntimes) for the valid values of `compatible_runtimes`. Once you have created your deployment package you can specify it either directly as a local file (using the `filename` argument) or indirectly via Amazon S3 (using the `s3_bucket`, `s3_key` and `s3_object_version` arguments). When providing the deployment package via S3 it may be useful to use the `aws.s3.BucketObjectv2` resource to upload it. For larger deployment packages it is recommended by Amazon to upload via S3, since the S3 API has better support for uploading large files efficiently. ## Import Using `pulumi import`, import Lambda Layers using `arn`. For example: ```sh $ pulumi import aws:lambda/layerVersion:LayerVersion test_layer arn:aws:lambda:_REGION_:_ACCOUNT_ID_:layer:_LAYER_NAME_:_LAYER_VERSION_ ```
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.pulumi.core.Output<java.lang.String> arn()  
      com.pulumi.core.Output<java.util.Optional<com.pulumi.asset.Archive>> code()  
      com.pulumi.core.Output<java.lang.String> codeSha256()  
      com.pulumi.core.Output<java.util.Optional<java.util.List<java.lang.String>>> compatibleArchitectures()  
      com.pulumi.core.Output<java.util.Optional<java.util.List<java.lang.String>>> compatibleRuntimes()  
      com.pulumi.core.Output<java.lang.String> createdDate()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> description()  
      static LayerVersion get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, LayerVersionState state, com.pulumi.resources.CustomResourceOptions options)
      Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
      com.pulumi.core.Output<java.lang.String> layerArn()  
      com.pulumi.core.Output<java.lang.String> layerName()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> licenseInfo()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> s3Bucket()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> s3Key()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> s3ObjectVersion()  
      com.pulumi.core.Output<java.lang.String> signingJobArn()  
      com.pulumi.core.Output<java.lang.String> signingProfileVersionArn()  
      com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> skipDestroy()  
      com.pulumi.core.Output<java.lang.String> sourceCodeHash()  
      com.pulumi.core.Output<java.lang.Integer> sourceCodeSize()  
      com.pulumi.core.Output<java.lang.String> version()  
      • Methods inherited from class com.pulumi.resources.CustomResource

        getId, id, idFuture
      • Methods inherited from class com.pulumi.resources.Resource

        getChildResources, getResourceName, getResourceType, getUrn, pulumiChildResources, pulumiResourceName, pulumiResourceType, urn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LayerVersion

        public LayerVersion​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • LayerVersion

        public LayerVersion​(java.lang.String name,
                            LayerVersionArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • LayerVersion

        public LayerVersion​(java.lang.String name,
                            LayerVersionArgs args,
                            @Nullable
                            com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • arn

        public com.pulumi.core.Output<java.lang.String> arn()
        Returns:
        ARN of the Lambda Layer with version.
      • code

        public com.pulumi.core.Output<java.util.Optional<com.pulumi.asset.Archive>> code()
        Returns:
        Path to the function's deployment package within the local filesystem. If defined, The `s3_`-prefixed options cannot be used.
      • codeSha256

        public com.pulumi.core.Output<java.lang.String> codeSha256()
        Returns:
        Base64-encoded representation of raw SHA-256 sum of the zip file.
      • compatibleArchitectures

        public com.pulumi.core.Output<java.util.Optional<java.util.List<java.lang.String>>> compatibleArchitectures()
        Returns:
        List of [Architectures](https://docs.aws.amazon.com/lambda/latest/dg/API_PublishLayerVersion.html#SSS-PublishLayerVersion-request-CompatibleArchitectures) this layer is compatible with. Currently `x86_64` and `arm64` can be specified.
      • compatibleRuntimes

        public com.pulumi.core.Output<java.util.Optional<java.util.List<java.lang.String>>> compatibleRuntimes()
        Returns:
        List of [Runtimes](https://docs.aws.amazon.com/lambda/latest/dg/API_PublishLayerVersion.html#SSS-PublishLayerVersion-request-CompatibleRuntimes) this layer is compatible with. Up to 15 runtimes can be specified.
      • createdDate

        public com.pulumi.core.Output<java.lang.String> createdDate()
        Returns:
        Date this resource was created.
      • description

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> description()
        Returns:
        Description of what your Lambda Layer does.
      • layerArn

        public com.pulumi.core.Output<java.lang.String> layerArn()
        Returns:
        ARN of the Lambda Layer without version.
      • layerName

        public com.pulumi.core.Output<java.lang.String> layerName()
        Returns:
        Unique name for your Lambda Layer The following arguments are optional:
      • licenseInfo

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> licenseInfo()
        Returns:
        License info for your Lambda Layer. See [License Info](https://docs.aws.amazon.com/lambda/latest/dg/API_PublishLayerVersion.html#SSS-PublishLayerVersion-request-LicenseInfo).
      • s3Bucket

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> s3Bucket()
        Returns:
        S3 bucket location containing the function's deployment package. Conflicts with `filename`. This bucket must reside in the same AWS region where you are creating the Lambda function.
      • s3Key

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> s3Key()
        Returns:
        S3 key of an object containing the function's deployment package. Conflicts with `filename`.
      • s3ObjectVersion

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> s3ObjectVersion()
        Returns:
        Object version containing the function's deployment package. Conflicts with `filename`.
      • signingJobArn

        public com.pulumi.core.Output<java.lang.String> signingJobArn()
        Returns:
        ARN of a signing job.
      • signingProfileVersionArn

        public com.pulumi.core.Output<java.lang.String> signingProfileVersionArn()
        Returns:
        ARN for a signing profile version.
      • skipDestroy

        public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> skipDestroy()
        Returns:
        Whether to retain the old version of a previously deployed Lambda Layer. Default is `false`. When this is not set to `true`, changing any of `compatible_architectures`, `compatible_runtimes`, `description`, `filename`, `layer_name`, `license_info`, `s3_bucket`, `s3_key`, `s3_object_version`, or `source_code_hash` forces deletion of the existing layer version and creation of a new layer version.
      • sourceCodeHash

        public com.pulumi.core.Output<java.lang.String> sourceCodeHash()
        Returns:
        Virtual attribute used to trigger replacement when source code changes. Must be set to a base64-encoded SHA256 hash of the package file specified with either `filename` or `s3_key`.
      • sourceCodeSize

        public com.pulumi.core.Output<java.lang.Integer> sourceCodeSize()
        Returns:
        Size in bytes of the function .zip file.
      • version

        public com.pulumi.core.Output<java.lang.String> version()
        Returns:
        Lambda Layer version.
      • get

        public static LayerVersion get​(java.lang.String name,
                                       com.pulumi.core.Output<java.lang.String> id,
                                       @Nullable
                                       LayerVersionState state,
                                       @Nullable
                                       com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.