Skip to Content
Learn AWS Serverless Computing
book

Learn AWS Serverless Computing

by Scott Patterson
December 2019
Intermediate to advanced
382 pages
9h 43m
English
Packt Publishing
Content preview from Learn AWS Serverless Computing

Layers

Lambda layers are a recent addition to the Lambda feature set and have already been built into the serverless.yml syntax. You learned about layers in a previous chapter.

To declare a layer in the Serverless Framework, we use a new top-level block called layers, as shown in the following code. We need to specify the path relative to the function's working directory. This is the directory that lambda will place the extracted files that were bundled in the layer in:

layers:   layerName:      path: /path/to/layer

This declares a layer. Now, we can attach it to a function. Notice that the reference to the layer means that our deploy command will look for that layer in our current serverless service. You'll also note that the framework capitalizes ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Practical Amazon EC2, SQS, Kinesis, and S3: A Hands-On Approach to AWS

Practical Amazon EC2, SQS, Kinesis, and S3: A Hands-On Approach to AWS

Sunil Gulabani

Publisher Resources

ISBN: 9781789958355