AWS::Lambda::LayerVersion
The AWS::Lambda::LayerVersion resource creates a layer version in AWS Lambda.
For more information, see AWS Lambda
Layers in the AWS Lambda Developer Guide.
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::Lambda::LayerVersion", "Properties" : { "CompatibleRuntimes" : [String, ... ], "Content" : Content, "Description" :String, "LayerName" :String, "LicenseInfo" :String} }
YAML
Type: "AWS::Lambda::LayerVersion" Properties: CompatibleRuntimes: -String- ... Content: Content Description:StringLayerName:StringLicenseInfo:String
Properties
CompatibleRuntimes-
A list of compatible function runtimes.
Required: No
Type: List of String values
Update requires: Replacement
Content-
The function layer archive.
Required: Yes
Type: Content
Update requires: Replacement
Description-
The description of the version.
Required: No
Type: String
Update requires: Replacement
LayerName-
The name of the layer.
Required: No
Type: String
Update requires: Replacement
LicenseInfo-
The layer's software license. It can be either of the following:
-
An SPDX license identifier. For example,
MIT. -
The URL of a license hosted on the internet. For example,
https://opensource.org/licenses/MIT.
Required: No
Type: String
Update requires: Replacement
-
Return Values
Ref
When you pass the logical ID of an AWS::Lambda::LayerVersion resource to
the intrinsic Ref function, the function returns the ARN of the layer version,
such as arn:aws:lambda:us-west-2:123456789012:layer:my-layer:1.
For more information about using the Ref function, see Ref.
Examples
Create a Layer Version
The following example creates a layer version from a ZIP file stored in Amazon S3.
JSON
{ "Type" : "AWS::Lambda::LayerVersion", "Properties" : { "CompatibleRuntimes" : [ "python3.6", "python3.7" ], "Content" : { "S3Bucket" : "my-bucket-us-west-2-123456789012", "S3Key" : "layer.zip" }, "Description" : "My layer", "LayerName" : "my-layer", "LicenseInfo" : "MIT" } }
YAML
Type: "AWS::Lambda::LayerVersion" Properties: CompatibleRuntimes: - python3.6 - python3.7 Content: S3Bucket: my-bucket-us-west-2-123456789012 S3Key: layer.zip Description: My layer LayerName: my-layer LicenseInfo: MIT
See Also
-
PublishLayerVersion in the AWS Lambda Developer Guide
