Lambda : Layers - How to add pymysql module as your function layer?

Publié le: 02 septembre 2023
sur la chaîne: Saborni Bhattacharya
3,326
52

In this video, I have talked about Lambda Layers which are zip archive file comprising of a custom runtime or additional dependency modules or binaries required by your function code. Layers can be shared across multiple functions. If you want to know more, please refer to this public document -

https://docs.aws.amazon.com/lambda/la...

As a demonstration, I have used pymysql (https://pypi.org/project/pymysql/) module that can be used as a client in your function with python runtime to connect to MySQL database. Here are the abridged steps -

$ mkdir python
$ cd python
$ pip3 install pymysql -t .
$ cd ..
$ chmod -R 755 python/
$ zip -r pymysql-layer.zip python/
$ aws s3 cp pymysql-layer.zip s3://YOUR-BUCKET/FOLDER

The above commands holds true for function with python runtime and for packages that is supported in Amazon Linux environments. Then follow the steps as specified in the public documentation of layers either using CLI command or Web console.

NOTE - Not endorsed by AWS, all opinions are mine.


Sur cette page du site, vous pouvez voir la vidéo en ligne Lambda : Layers - How to add pymysql module as your function layer? durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Saborni Bhattacharya 02 septembre 2023, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 3,326 fois et il a aimé 52 téléspectateurs. Bon visionnage!