LayerVersionArgs

data class LayerVersionArgs(val code: Output<Archive>? = null, val compatibleArchitectures: Output<List<String>>? = null, val compatibleRuntimes: Output<List<String>>? = null, val description: Output<String>? = null, val layerName: Output<String>? = null, val licenseInfo: Output<String>? = null, val s3Bucket: Output<String>? = null, val s3Key: Output<String>? = null, val s3ObjectVersion: Output<String>? = null, val skipDestroy: Output<Boolean>? = null, val sourceCodeHash: Output<String>? = null) : ConvertibleToJava<LayerVersionArgs>

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.

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

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()
.compatibleRuntimes("nodejs16.x")
.code(new FileArchive("lambda_layer_payload.zip"))
.layerName("lambda_layer_name")
.build());
}
}

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 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

Lambda Layers can be imported using arn.

$ pulumi import aws:lambda/layerVersion:LayerVersion \

aws_lambda_layer_version.test_layer
arn:aws:lambda:REGION:ACCOUNT_ID:layer:LAYER_NAME:LAYER_VERSION

Constructors

Link copied to clipboard
constructor(code: Output<Archive>? = null, compatibleArchitectures: Output<List<String>>? = null, compatibleRuntimes: Output<List<String>>? = null, description: Output<String>? = null, layerName: Output<String>? = null, licenseInfo: Output<String>? = null, s3Bucket: Output<String>? = null, s3Key: Output<String>? = null, s3ObjectVersion: Output<String>? = null, skipDestroy: Output<Boolean>? = null, sourceCodeHash: Output<String>? = null)

Properties

Link copied to clipboard
val code: Output<Archive>? = null

Path to the function's deployment package within the local filesystem. If defined, The s3_-prefixed options cannot be used.

Link copied to clipboard
val compatibleArchitectures: Output<List<String>>? = null

List of Architectures this layer is compatible with. Currently x86_64 and arm64 can be specified.

Link copied to clipboard
val compatibleRuntimes: Output<List<String>>? = null

List of Runtimes this layer is compatible with. Up to 5 runtimes can be specified.

Link copied to clipboard
val description: Output<String>? = null

Description of what your Lambda Layer does.

Link copied to clipboard
val layerName: Output<String>? = null

Unique name for your Lambda Layer The following arguments are optional:

Link copied to clipboard
val licenseInfo: Output<String>? = null

License info for your Lambda Layer. See License Info.

Link copied to clipboard
val s3Bucket: Output<String>? = null

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.

Link copied to clipboard
val s3Key: Output<String>? = null

S3 key of an object containing the function's deployment package. Conflicts with filename.

Link copied to clipboard
val s3ObjectVersion: Output<String>? = null

Object version containing the function's deployment package. Conflicts with filename.

Link copied to clipboard
val skipDestroy: Output<Boolean>? = null

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.

Link copied to clipboard
val sourceCodeHash: Output<String>? = null

Used to trigger updates. Must be set to a base64-encoded SHA256 hash of the package file specified with either filename or s3_key.

Functions

Link copied to clipboard
open override fun toJava(): LayerVersionArgs