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
new LayerVersion(name: string, args: LayerVersionArgs, opts?: CustomResourceOptions);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)public LayerVersion(string name, LayerVersionArgs args, CustomResourceOptions? opts = null)- 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:
- Layer
Name 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.- Compatible
Runtimes 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.
- License
Info 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.- S3Object
Version string The object version containing the function’s deployment package. Conflicts with
filename.- Source
Code stringHash Used to trigger updates. Must be set to a base64-encoded SHA256 hash of the package file specified with either
filenameors3_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 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.- Compatible
Runtimes []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.
- License
Info 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.- S3Object
Version string The object version containing the function’s deployment package. Conflicts with
filename.- Source
Code stringHash Used to trigger updates. Must be set to a base64-encoded SHA256 hash of the package file specified with either
filenameors3_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 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.- compatible
Runtimes 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.
- license
Info 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.- s3Object
Version string The object version containing the function’s deployment package. Conflicts with
filename.- source
Code stringHash Used to trigger updates. Must be set to a base64-encoded SHA256 hash of the package file specified with either
filenameors3_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_ strversion The object version containing the function’s deployment package. Conflicts with
filename.- source_
code_ strhash Used to trigger updates. Must be set to a base64-encoded SHA256 hash of the package file specified with either
filenameors3_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.
- Created
Date string The date this resource was created.
- Id string
- The provider-assigned unique ID for this managed resource.
- Layer
Arn string The Amazon Resource Name (ARN) of the Lambda Layer without version.
- Source
Code intSize 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.
- Created
Date string The date this resource was created.
- Id string
- The provider-assigned unique ID for this managed resource.
- Layer
Arn string The Amazon Resource Name (ARN) of the Lambda Layer without version.
- Source
Code intSize 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.
- created
Date string The date this resource was created.
- id string
- The provider-assigned unique ID for this managed resource.
- layer
Arn string The Amazon Resource Name (ARN) of the Lambda Layer without version.
- source
Code numberSize 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_ floatsize 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): LayerVersionstatic 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.- Compatible
Runtimes List<string> A list of Runtimes this layer is compatible with. Up to 5 runtimes can be specified.
- Created
Date string The date this resource was created.
- Description string
Description of what your Lambda Layer does.
- Layer
Arn string The Amazon Resource Name (ARN) of the Lambda Layer without version.
- Layer
Name string A unique name for your Lambda Layer
- License
Info 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.- S3Object
Version string The object version containing the function’s deployment package. Conflicts with
filename.- Source
Code stringHash Used to trigger updates. Must be set to a base64-encoded SHA256 hash of the package file specified with either
filenameors3_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 intSize 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.- Compatible
Runtimes []string A list of Runtimes this layer is compatible with. Up to 5 runtimes can be specified.
- Created
Date string The date this resource was created.
- Description string
Description of what your Lambda Layer does.
- Layer
Arn string The Amazon Resource Name (ARN) of the Lambda Layer without version.
- Layer
Name string A unique name for your Lambda Layer
- License
Info 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.- S3Object
Version string The object version containing the function’s deployment package. Conflicts with
filename.- Source
Code stringHash Used to trigger updates. Must be set to a base64-encoded SHA256 hash of the package file specified with either
filenameors3_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 intSize 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.- compatible
Runtimes string[] A list of Runtimes this layer is compatible with. Up to 5 runtimes can be specified.
- created
Date string The date this resource was created.
- description string
Description of what your Lambda Layer does.
- layer
Arn string The Amazon Resource Name (ARN) of the Lambda Layer without version.
- layer
Name string A unique name for your Lambda Layer
- license
Info 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.- s3Object
Version string The object version containing the function’s deployment package. Conflicts with
filename.- source
Code stringHash Used to trigger updates. Must be set to a base64-encoded SHA256 hash of the package file specified with either
filenameors3_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 numberSize 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_ strversion The object version containing the function’s deployment package. Conflicts with
filename.- source_
code_ strhash Used to trigger updates. Must be set to a base64-encoded SHA256 hash of the package file specified with either
filenameors3_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_ floatsize 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
awsTerraform Provider.