LayerVersion

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

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

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var lambdaLayer = new Aws.Lambda.LayerVersion("lambdaLayer", new Aws.Lambda.LayerVersionArgs
        {
            CompatibleRuntimes = 
            {
                "nodejs8.10",
            },
            Code = new FileArchive("lambda_layer_payload.zip"),
            LayerName = "lambda_layer_name",
        });
    }

}

Coming soon!

import pulumi
import pulumi_aws as aws

lambda_layer = aws.lambda_.LayerVersion("lambdaLayer",
    compatible_runtimes=["nodejs8.10"],
    code=pulumi.FileArchive("lambda_layer_payload.zip"),
    layer_name="lambda_layer_name")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const lambdaLayer = new aws.lambda.LayerVersion("lambda_layer", {
    compatibleRuntimes: ["nodejs8.10"],
    code: new pulumi.asset.FileArchive("lambda_layer_payload.zip"),
    layerName: "lambda_layer_name",
});

Create a LayerVersion Resource

def LayerVersion(resource_name, opts=None, code=None, compatible_runtimes=None, description=None, layer_name=None, license_info=None, s3_bucket=None, s3_key=None, s3_object_version=None, source_code_hash=None, __props__=None);
func NewLayerVersion(ctx *Context, name string, args LayerVersionArgs, opts ...ResourceOption) (*LayerVersion, error)
name string
The unique name of the resource.
args LayerVersionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args LayerVersionArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args LayerVersionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

LayerVersion Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The LayerVersion resource accepts the following input properties:

LayerName string

A unique name for your Lambda Layer

Code Archive

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

CompatibleRuntimes List<string>

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

Description string

Description of what your Lambda Layer does.

LicenseInfo string

License info for your Lambda Layer. See License Info.

S3Bucket string

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

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

S3ObjectVersion string

The object version containing the function’s deployment package. Conflicts with filename.

SourceCodeHash string

Used to trigger updates. Must be set to a base64-encoded SHA256 hash of the package file specified with either filename or s3_key. The usual way to set this is ${filebase64sha256("file.zip")} (this provider 0.11.12 or later) or ${base64sha256(file("file.zip"))} (this provider 0.11.11 and earlier), where “file.zip” is the local filename of the lambda layer source archive.

LayerName string

A unique name for your Lambda Layer

Code pulumi.Archive

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

CompatibleRuntimes []string

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

Description string

Description of what your Lambda Layer does.

LicenseInfo string

License info for your Lambda Layer. See License Info.

S3Bucket string

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

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

S3ObjectVersion string

The object version containing the function’s deployment package. Conflicts with filename.

SourceCodeHash string

Used to trigger updates. Must be set to a base64-encoded SHA256 hash of the package file specified with either filename or s3_key. The usual way to set this is ${filebase64sha256("file.zip")} (this provider 0.11.12 or later) or ${base64sha256(file("file.zip"))} (this provider 0.11.11 and earlier), where “file.zip” is the local filename of the lambda layer source archive.

layerName string

A unique name for your Lambda Layer

code pulumi.asset.Archive

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

compatibleRuntimes string[]

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

description string

Description of what your Lambda Layer does.

licenseInfo string

License info for your Lambda Layer. See License Info.

s3Bucket string

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

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

s3ObjectVersion string

The object version containing the function’s deployment package. Conflicts with filename.

sourceCodeHash string

Used to trigger updates. Must be set to a base64-encoded SHA256 hash of the package file specified with either filename or s3_key. The usual way to set this is ${filebase64sha256("file.zip")} (this provider 0.11.12 or later) or ${base64sha256(file("file.zip"))} (this provider 0.11.11 and earlier), where “file.zip” is the local filename of the lambda layer source archive.

layer_name str

A unique name for your Lambda Layer

code pulumi.Archive

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

compatible_runtimes List[str]

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

description str

Description of what your Lambda Layer does.

license_info str

License info for your Lambda Layer. See License Info.

s3_bucket str

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

s3_key str

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

s3_object_version str

The object version containing the function’s deployment package. Conflicts with filename.

source_code_hash str

Used to trigger updates. Must be set to a base64-encoded SHA256 hash of the package file specified with either filename or s3_key. The usual way to set this is ${filebase64sha256("file.zip")} (this provider 0.11.12 or later) or ${base64sha256(file("file.zip"))} (this provider 0.11.11 and earlier), where “file.zip” is the local filename of the lambda layer source archive.

Outputs

All input properties are implicitly available as output properties. Additionally, the LayerVersion resource produces the following output properties:

Arn string

The Amazon Resource Name (ARN) of the Lambda Layer with version.

CreatedDate string

The date this resource was created.

Id string
The provider-assigned unique ID for this managed resource.
LayerArn string

The Amazon Resource Name (ARN) of the Lambda Layer without version.

SourceCodeSize int

The size in bytes of the function .zip file.

Version string

This Lamba Layer version.

Arn string

The Amazon Resource Name (ARN) of the Lambda Layer with version.

CreatedDate string

The date this resource was created.

Id string
The provider-assigned unique ID for this managed resource.
LayerArn string

The Amazon Resource Name (ARN) of the Lambda Layer without version.

SourceCodeSize int

The size in bytes of the function .zip file.

Version string

This Lamba Layer version.

arn string

The Amazon Resource Name (ARN) of the Lambda Layer with version.

createdDate string

The date this resource was created.

id string
The provider-assigned unique ID for this managed resource.
layerArn string

The Amazon Resource Name (ARN) of the Lambda Layer without version.

sourceCodeSize number

The size in bytes of the function .zip file.

version string

This Lamba Layer version.

arn str

The Amazon Resource Name (ARN) of the Lambda Layer with version.

created_date str

The date this resource was created.

id str
The provider-assigned unique ID for this managed resource.
layer_arn str

The Amazon Resource Name (ARN) of the Lambda Layer without version.

source_code_size float

The size in bytes of the function .zip file.

version str

This Lamba Layer version.

Look up an Existing LayerVersion Resource

Get an existing LayerVersion resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: LayerVersionState, opts?: CustomResourceOptions): LayerVersion
static get(resource_name, id, opts=None, arn=None, code=None, compatible_runtimes=None, created_date=None, description=None, layer_arn=None, layer_name=None, license_info=None, s3_bucket=None, s3_key=None, s3_object_version=None, source_code_hash=None, source_code_size=None, version=None, __props__=None);
func GetLayerVersion(ctx *Context, name string, id IDInput, state *LayerVersionState, opts ...ResourceOption) (*LayerVersion, error)
public static LayerVersion Get(string name, Input<string> id, LayerVersionState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

Arn string

The Amazon Resource Name (ARN) of the Lambda Layer with version.

Code Archive

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

CompatibleRuntimes List<string>

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

CreatedDate string

The date this resource was created.

Description string

Description of what your Lambda Layer does.

LayerArn string

The Amazon Resource Name (ARN) of the Lambda Layer without version.

LayerName string

A unique name for your Lambda Layer

LicenseInfo string

License info for your Lambda Layer. See License Info.

S3Bucket string

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

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

S3ObjectVersion string

The object version containing the function’s deployment package. Conflicts with filename.

SourceCodeHash string

Used to trigger updates. Must be set to a base64-encoded SHA256 hash of the package file specified with either filename or s3_key. The usual way to set this is ${filebase64sha256("file.zip")} (this provider 0.11.12 or later) or ${base64sha256(file("file.zip"))} (this provider 0.11.11 and earlier), where “file.zip” is the local filename of the lambda layer source archive.

SourceCodeSize int

The size in bytes of the function .zip file.

Version string

This Lamba Layer version.

Arn string

The Amazon Resource Name (ARN) of the Lambda Layer with version.

Code pulumi.Archive

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

CompatibleRuntimes []string

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

CreatedDate string

The date this resource was created.

Description string

Description of what your Lambda Layer does.

LayerArn string

The Amazon Resource Name (ARN) of the Lambda Layer without version.

LayerName string

A unique name for your Lambda Layer

LicenseInfo string

License info for your Lambda Layer. See License Info.

S3Bucket string

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

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

S3ObjectVersion string

The object version containing the function’s deployment package. Conflicts with filename.

SourceCodeHash string

Used to trigger updates. Must be set to a base64-encoded SHA256 hash of the package file specified with either filename or s3_key. The usual way to set this is ${filebase64sha256("file.zip")} (this provider 0.11.12 or later) or ${base64sha256(file("file.zip"))} (this provider 0.11.11 and earlier), where “file.zip” is the local filename of the lambda layer source archive.

SourceCodeSize int

The size in bytes of the function .zip file.

Version string

This Lamba Layer version.

arn string

The Amazon Resource Name (ARN) of the Lambda Layer with version.

code pulumi.asset.Archive

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

compatibleRuntimes string[]

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

createdDate string

The date this resource was created.

description string

Description of what your Lambda Layer does.

layerArn string

The Amazon Resource Name (ARN) of the Lambda Layer without version.

layerName string

A unique name for your Lambda Layer

licenseInfo string

License info for your Lambda Layer. See License Info.

s3Bucket string

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

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

s3ObjectVersion string

The object version containing the function’s deployment package. Conflicts with filename.

sourceCodeHash string

Used to trigger updates. Must be set to a base64-encoded SHA256 hash of the package file specified with either filename or s3_key. The usual way to set this is ${filebase64sha256("file.zip")} (this provider 0.11.12 or later) or ${base64sha256(file("file.zip"))} (this provider 0.11.11 and earlier), where “file.zip” is the local filename of the lambda layer source archive.

sourceCodeSize number

The size in bytes of the function .zip file.

version string

This Lamba Layer version.

arn str

The Amazon Resource Name (ARN) of the Lambda Layer with version.

code pulumi.Archive

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

compatible_runtimes List[str]

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

created_date str

The date this resource was created.

description str

Description of what your Lambda Layer does.

layer_arn str

The Amazon Resource Name (ARN) of the Lambda Layer without version.

layer_name str

A unique name for your Lambda Layer

license_info str

License info for your Lambda Layer. See License Info.

s3_bucket str

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

s3_key str

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

s3_object_version str

The object version containing the function’s deployment package. Conflicts with filename.

source_code_hash str

Used to trigger updates. Must be set to a base64-encoded SHA256 hash of the package file specified with either filename or s3_key. The usual way to set this is ${filebase64sha256("file.zip")} (this provider 0.11.12 or later) or ${base64sha256(file("file.zip"))} (this provider 0.11.11 and earlier), where “file.zip” is the local filename of the lambda layer source archive.

source_code_size float

The size in bytes of the function .zip file.

version str

This Lamba Layer version.

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.