filmov
tv
How To Create Lambda Layer (2 Min) | AWS | Package Python Libraries For Lambda Functions
Показать описание
In this tutorial, you'll learn how to create a lambda layer to package libraries and other dependencies that you can use with your AWS Lambda functions. Using layers reduces the size of uploaded deployment archives and makes it faster to deploy your code.
—
—
Video Transcript:
—
Hi guys, this is Abhi from Gokcedb. In this video, you're going to learn how to add a Python Lambda Layer in AWS. Let's start by navigating to the Lambda service then click on create function and give it a name.
Hit deploy then click on test and give your test event a name then hit save. Click on test again to execute your Lambda function and you should receive an error message saying unable to import module name requests. To fix this error, we're going to create a Lambda layer.
I'm going to copy and paste the virtual environment folder from an existing project which has the requests package installed already. Let's rename this folder to Python which is the requirement according to this AWS guide. Feel free to remove any unnecessary folders or libraries that you don't need in this layer.
Select comparable architectures and runtimes then hit create. Now go back to your Lambda function then click on layers in the function overview section. Click on add a layer button then choose custom layers.
Choose the custom layer that we just created then hit add. Click on the test button and this time your Lambda function should execute without any errors. As you can see the HTML was printed on the console.
There you have it. Make sure you like, subscribe, and turn on the notification bell. Until next time.
—
—
Video Transcript:
—
Hi guys, this is Abhi from Gokcedb. In this video, you're going to learn how to add a Python Lambda Layer in AWS. Let's start by navigating to the Lambda service then click on create function and give it a name.
Hit deploy then click on test and give your test event a name then hit save. Click on test again to execute your Lambda function and you should receive an error message saying unable to import module name requests. To fix this error, we're going to create a Lambda layer.
I'm going to copy and paste the virtual environment folder from an existing project which has the requests package installed already. Let's rename this folder to Python which is the requirement according to this AWS guide. Feel free to remove any unnecessary folders or libraries that you don't need in this layer.
Select comparable architectures and runtimes then hit create. Now go back to your Lambda function then click on layers in the function overview section. Click on add a layer button then choose custom layers.
Choose the custom layer that we just created then hit add. Click on the test button and this time your Lambda function should execute without any errors. As you can see the HTML was printed on the console.
There you have it. Make sure you like, subscribe, and turn on the notification bell. Until next time.
Комментарии