Import package in AWS Lambda Layer

Published: 27 September 2022
on channel: ChrisWebCode
595
13

0:43 Create the environment to build a Layer
4:42 Package a Layer for AWS Lambda
6:31 Import packaged Layer into AWS Lambda
7:22 Test it out in AWS Lambda

Commands used in the video
```
cd
sudo yum upgrade -y
sudo yum install -y docker
sudo service docker status
sudo service docker start
sudo service docker status

mkdir demo-create-layer
cd demo-create-layer/
vi requirements.txt
python-ldap==3.4.2
mkdir python
sudo docker run -v "$PWD":/var/task "lambci/lambda:build-python3.8" /bin/sh -c "yum install -y gcc openldap-devel; pip install -r requirements.txt -t python/lib/python3.8/site-packages/; exit;"

ls python/lib/python3.8/site-packages/

mkdir lib
cp /usr/lib64/libldap_r-2.4.so.2 ./lib/.
cp /usr/lib64/libldap-2.4.so.2 ./lib/.
cp /usr/lib64/liblber-2.4.so.2 ./lib/.
cp /usr/lib64/libsasl2.so.3 ./lib/.
cp /usr/lib64/libssl3.so ./lib/.
cp /usr/lib64/libsmime3.so ./lib/.
cp /usr/lib64/libnss3.so ./lib/.
ls lib

pwd
zip -9 -r ldap.zip python
zip -9 -r ldap.zip lib

ls
aws s3 cp ldap.zip s3://demo123/ldap.zip
```

----------------------------------------------------------------------
AND SOME LINKS
----------------------------------------------------------------------
Python's import machinery
https://docs.python.org/3/reference/i...

----------------------------------------------------------------------
DESCRIPTION
----------------------------------------------------------------------
Running Python in AWS Lambda is easy and so is importing packages you need for serverless execution. Importing python-ldap package into AWS Lambda is what this video showcases, so you can use it to import that package (or any other package) needed for your serverless AWS Lambda execution.


On this page of the site you can watch the video online Import package in AWS Lambda Layer with a duration of hours minute second in good quality, which was uploaded by the user ChrisWebCode 27 September 2022, share the link with friends and acquaintances, this video has already been watched 595 times on youtube and it was liked by 13 viewers. Enjoy your viewing!