LayerContent
A ZIP archive that contains the contents of an Lambda layer.
Syntax
To declare this entity in your AWS Serverless Application Model (AWS SAM) template, use the following syntax.
YAML
Bucket:StringKey:StringStorageMode:StringVersion:String
Properties
-
Bucket -
The Amazon S3 bucket of the layer archive.
Type: String
Required: Yes
CloudFormation compatibility: This property is passed directly to the
S3Bucketproperty of theAWS::Lambda::LayerVersionContentdata type. -
Key -
The Amazon S3 key of the layer archive.
Type: String
Required: Yes
CloudFormation compatibility: This property is passed directly to the
S3Keyproperty of theAWS::Lambda::LayerVersionContentdata type. -
StorageMode -
Controls how Lambda stores the layer archive.
-
COPY– Lambda uploads a copy of your layer archive to Lambda-managed storage. You can delete the Amazon S3 object after Lambda creates the layer version. -
REFERENCE– Lambda references the layer archive from your Amazon S3 bucket and doesn't store a copy. The object must remain in place, and Lambda must keep access to it, for the lifetime of the layer version.
To use
REFERENCE, enable versioning on your Amazon S3 bucket and grant the Lambda service principal access to the object. For more information, see Self-managed Amazon S3 code storage in the AWS Lambda Developer Guide.Type: String
Valid values:
COPY|REFERENCERequired: No
Default:
COPYCloudFormation compatibility: This property is passed directly to the
S3ObjectStorageModeproperty of theAWS::Lambda::LayerVersionContentdata type. -
-
Version -
For versioned objects, the version of the layer archive object to use.
Type: String
Required: No
CloudFormation compatibility: This property is passed directly to the
S3ObjectVersionproperty of theAWS::Lambda::LayerVersionContentdata type.
Examples
LayerContent
Layer Content example
YAML
LayerContent: Bucket: amzn-s3-demo-bucket-name Key: mykey-name Version: 121212
Self-managed Amazon S3 code storage
The following LayerContent references the layer archive from your own Amazon S3 bucket instead of copying it to Lambda-managed storage.
YAML
LayerContent: Bucket: amzn-s3-demo-bucket-name Key: mykey-name Version: 121212 StorageMode: REFERENCE