Slide 1

Slide 1 text

AWS Lambda Layers FTW! Serverless On Stage #20 - Milan, 12/02/2019

Slide 2

Slide 2 text

Working with AWS Lambda? Don’t repeat yourself!

Slide 3

Slide 3 text

HELLO! I am Francesco Lerro I am a Solution Architect who loves the Cloud Find me on Twitter @flerro

Slide 4

Slide 4 text

DEPLOY Code External Library 1 External Library 2 MyFunction 1 data.json Function code Code External Library 1 Custom Module 1 MyFunction 2 data.json Function code Code Custom Module 1 External Library 2 MyFunction 3 data.json Function code Non DRY!

Slide 5

Slide 5 text

DEPLOY (shared modules) Code MyFunction 1 Function code Code MyFunction 2 Function code Code MyFunction 3 Function code External Library 2 data.json Custom Module 1 External Library 1 MyBundle1

Slide 6

Slide 6 text

Lambda Layer A collection of arbitrary code, third party libraries and data that can be referenced by many Lambda functions

Slide 7

Slide 7 text

Lambda Layer benefits ∎ Enforce separation of concerns ∎ Enable code reuse between functions ∎ Allow faster deployment, avoiding duplication

Slide 8

Slide 8 text

Using Lambda Layers 1. Put shared components and data in a ZIP package 2. Create a new layer version, uploading the ZIP package 3. Reference layer version from a function

Slide 9

Slide 9 text

Paths Default paths for Lambda Layers unzipped

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

Lambda Layers limits ∎ Up to 5 layers can be used per function ∎ Max extracted size per layer is 250MB

Slide 12

Slide 12 text

Lambda Layers access ∎ Shareable across same account, different AWS accounts or public ∎ When deleted, a layer could not be referenced by newer functions ∎ AWS provides NumPy/SciPy layer for ML application

Slide 13

Slide 13 text

SAM A SAM template with Lambda and Layer, use SAM CLI 0.9.0+

Slide 14

Slide 14 text

DEMO Code available on Github: https://github.com/flerro/lambda-layers-FTW

Slide 15

Slide 15 text

THANKS! Any questions? Content released under Public Domain Presentation template by SlidesCarnival