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

Using a Lambda layer

Let's have a go at creating our own Lambda layer using the console and then see if we can share it with another account. For this example, we're going to create a layer in Python that simply passes a message back to our handler. Let's get started:

  1. We'll start by writing the code that will make up our layer. The following is a super simple function that returns a message:
def provide_message():    return "Hello Lambda learners!"
  1. Save that file as message_vendor.py, in a folder called python. This is important because our layer gets extracted into the /opt directory. The directory is automatically added to the path variable, making it easily accessible to our actual function. We must make sure we are following the directory ...
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