Lambda Layers was recently incorporated into AWS, which basically allows you to share libraries and codes between Lambda functions. This makes it possible to speed up development since now it is not necessary to pack all libraries with the Lambda function, as we used to do with Alexa’s ASK, but now these libraries can be uploaded independently in Lambda Layers and used directly in our functions.
Alexa’s ASK SDK
To prepare Alexa’s ASK for Lambda Layers we can follow the following steps:
pip install ask-sdk
zip -r ask-sdk.zip python/lib/python3.6/site-packages/
Now you can use the Alexa’s ASK SDK from your lambda functions without having to upload it in each deployment.
Uploading the ASK SDK to Lambda Layers
The first thing we must do is to create the Lambda Layers from the console:
Then you must fill out the form and select the .zip that you created to upload it, and finally you must indicate the runtime with which it is compatible.
Once created, we can see the description and the version:
How to include the ASK SDK from Lambda Layers?
Got to your Lambda function and right under yout function name you can click on Layers
From the below section Referenced layers click on the Add a layer button
- Select the ask-sdk layer from the drop-down menu, and click on Add
As you can see below, the Lambda Layer with the Alexa’s ASK SDK can now be used in this Lambda function:
You can select this same Layer for other Lambda functions that use the same ASK SDK and runtime without having to be uploading it in each deployment.