Skip to content

Instantly share code, notes, and snippets.

@singledigit
Last active April 22, 2024 16:03
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save singledigit/7ad688e2424619e4ef1de5eafb90c79a to your computer and use it in GitHub Desktop.
Save singledigit/7ad688e2424619e4ef1de5eafb90c79a to your computer and use it in GitHub Desktop.
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: '*'
@Fabiankop
Copy link

Thank's !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment