Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to create and manage a Lambda Layer using AWS SAM
## Manage your Lambda layer in SAM
## This creates a layer and the permissions for the layer. This particular permission opens it to the world.
## I then use 'sam package' and 'sam deploy' to create/update the layer
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Lambda Layer
Resources:
MyLayer:
Type: AWS::Serverless::LayerVersion
Properties:
LayerName: layer-name
Description: layer-description
ContentUri: layer/ ## Local folder containing layer contents
CompatibleRuntimes: ## Works with any of the supported languages
- nodejs8.10
- nodejs10.x
LicenseInfo: 'MIT'
RetentionPolicy: Retain
AWSSDKLayerPermission:
Type: "AWS::Lambda::LayerVersionPermission"
Properties:
Action: lambda:GetLayerVersion
LayerVersionArn: !Ref MyLayer
Principal: '*'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.