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:
- 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!"
- 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 ...